Ddval Function

Top  Previous  Next

Function:

Converts "dot-decimal string" into "dot-decimal value".

Syntax:

ddval (byref str as string) as string

Returns:

A string of binary values.

See Also:

ddstr

 


Part

Description

str

Dot-decimal string to be converted into a string of binary values. This string should comprise one or more dot-separated decimal values in the 0-255 range. Values that exceed 255 will produce an overflow, so result will be incorrect. If any other character other than "0"-"9" or "." is encountered then all digits after this character and up to the next "." (if any) will be ignored. Leading spaces before each decimal value are allowed.

Details

This function is convenient for converting string representation of groups of bytes (such as IP or MAC addresses) into their binary form.

Examples

 

dim s as string

 

s = "192_3.1254.. 30" 'One value has invalid character in it ("_") and "3" after this character will be ignored. Dot-decimal string. Another value -- 1254 -- is out of range. Yet another value is missing and will be replaced with 0.

s = ddstr(s) 'now s will contain these values: 192, 230, 0, 30.