PDA

Click to See Complete Forum and Search --> : How to read characters from string variable


Oct 10th, 2000, 04:19 PM
Hi there, I would need to know if there's a way to read characters of any given string variable with vbscript. In my case all I need to find out is the first character of a string. This is how I picture the codes:

strvar = "A1"
firstchar = strvar(0)


... but I know if I do this I would then make reference to an array which isn't what I wanna do. If you have a better way to do it please let me know. Thanks.

ccoder
Oct 10th, 2000, 04:31 PM
Are the Left$, Mid$ and Right$ functions available in VBScript? (I've never done any VBScript)

If so, then firstchar = Left$(strvar, 1) will do it.

monte96
Oct 10th, 2000, 07:38 PM
Actually they are but without the $


In VBScript, everything is a variant so you have to use the Left(), Right() and Mid() functions instead.