String
You assign string using the double quote delimiter. For example
1 | dim s as string = "hello world" |
Sometimes you need the character data type, you can simulate this by placing the lower case c at the end of a string assignment. For example
1 | dim s as string = "(this,that,and the other) |
That second assignment (creating the this variable) did that by calling the Split function of a string. This function requires a Character datatype so I suffixed “,” with the c to provide a character.
Converting String to Numbers
There are functions used to convert a string into a number, for example cdbl(stringvar) and cint(stringvar) which will convert a string into a double or integer.
? cdbl(9)
= 9
? cdbl(“9”)
= 9
? cdbl(“”)
throws error
Checking a String to see if it’s a number
1 | Private Function IsValidNumber(input As String) As Boolean |