String_To_Number_Binary

Get a string’s binary representation. Parsing the string continues until a character other than a 0 or 1 is reached.

Parameters

String

The string that represents a number.

Format

String_To_Number_Binary (String)

Return Value

Returns the binary number represented by the string. If the string does not represent a binary number, a 0 is returned.

Example

Script( String_To_Number_Binary_Test )
String( strEntered )
String( strMessage )
String( strBinary )
String( strDecimal )
String( strHexUpper )
String( strOctal )
Number( nBinary )
Activate( From_Menu )
strEntered = Ask_String( "Enter a binary number", "String_To_Number_Binary", 1, 99, "10100101" )
nBinary = String_To_Number_Binary( strEntered )
strBinary = strEntered
strDecimal = Number_To_String_Decimal( nBinary )
strHexUpper = Number_To_String_Hexadecimal_Uppercase( nBinary )
strOctal = Number_To_String_Octal( nBinary )
strMessage = String_Combine( "Binary:", strBinary )
strMessage = String_Combine( strMessage, "; Octal: " )
strMessage = String_Combine( strMessage, strOctal )
strMessage = String_Combine( strMessage, "; Decimal: " )
strMessage = String_Combine( strMessage, strDecimal )
strMessage = String_Combine( strMessage, "; Hexadecimal:" )
strMessage = String_Combine( strMessage, strHexUpper )
Ask_OK( strMessage, "String_To_Number_Binary" )
Return

See Also

String_To_Number_Octal, String_To_Number_Decimal, String_To_Number_Hexadecimal, Number_Equal, String_Set, Number_Set

 


Was this article useful?    

The topic was:

Inaccurate

Incomplete

Not what I expected

Other

Privacy and Legal