Imports System Imports uCalcSoftware Public Module Program Public Sub Main() Dim uc As New uCalc() '// Define a token for C-like 0x hex notation uc.ExpressionTokens.Add("0x[0-9A-Fa-f]+", TokenType.TokenTransform) uc.TokenTransformer.FromTo("{'0x'}{Num:'[0-9A-Fa-f]+'}", "BaseConvert('{Num}', 16)") Console.WriteLine($"0xFF is evaluated as: {uc.EvalStr("0xFF")}") '// Define a token for C++-style 0b binary notation uc.ExpressionTokens.Add("0b[01]+", TokenType.TokenTransform) '// Using {@Eval} is more efficient as the conversion happens once during the token transform pass. uc.TokenTransformer.FromTo("{'0b'}{Num:'[01]+'}", "{@Eval: BaseConvert(Num, 2)}") Console.WriteLine($"0b1011 is evaluated as: {uc.EvalStr("0b1011")}") '// Note: uCalc has built-in support for hex/binary using # notation (e.g., #hFF, #b1011) Console.WriteLine($"uCalc's built-in #hFF is: {uc.EvalStr("#hFF")}") End Sub End Module