BigIntegerStatic: TryParse

TryParse

Attemps to parse a string of characters of the specified base type.



 Public Function TryParse(
	  ByVal s As String,
	  ByRef b As BigInteger ) As Boolean

Parameters

s
[ByVal] String. The string of characters to attempt to be parsed.
b
[ByRef] BigInteger. The returning BigInteger object if the string was successfully parsed.

Return Values

Boolean -  Returns True if the string was parsed, False otherwise.

Remarks

3 base types are supported for parsing (Decimal, Hex, Binary.) The string must include a base type specifier for Hex and Binary. Decimal is the default.

Hex Specifiers: 0x, 0X, &H, &H - (0xFF, 0XFF, &HFF, &HFF)
Binary Specifiers: 0b, 0B - (0b00001111, 0B000011111)

Anything else will default to Decimal.
"-" is supported for all types of parsing.
 Dim b As BigInteger
 Debug.Print BigInteger.TryParse("-&H7FFF", b) ' True
 Debug.Print b.ToString("X") ' 8001
 

Parsing is not case sensitive.

See Also

Project VBCorLib Overview Class BigIntegerStatic Overview BigIntegerStatic Properties BigIntegerStatic Methods ToString XorBits