Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

extract first character from string 1

Status
Not open for further replies.

meldrape

Programmer
May 12, 2001
516
US
Hi there,

If I were to extract the first character from a string to see what the value is, how could I go about doing it?

i.e. strString=request("number")

response.write strString

the result, let's say, is 4567123456781234

What if I wanted to extract the first character so I could do a query later? Is it possible? Would I use the split method?

Any ideas would be greatly appreciated. Thanks!

 
hi meldrape,

kind of new to this game myself but here goes.

you could try a left function.

e.g.
strString=left(request("number"),1)

response.write strString

hope thats the one

Storm
 
You could also do it this way
dim variable
set variable = mid(value,1,1)
now you have the first character in a variable called variable and can do what you want with it

Hope that helps

Roj

 
Thanks to both of you. I used the left function, and it worked just as I needed. Thanks again.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top