Click to See Complete Forum and Search --> : Selecting characters
matrix
Jan 21st, 2000, 06:56 AM
If i have a string of text named Zstring, and it currently holds the text:
"Dogs are big"
If I want it to read, for example, the 4th character in the string, which in this case is "s", how do I find that out.
MartinLiss
Jan 21st, 2000, 07:28 AM
Look up the Mid function.
------------------
Marty
Can you buy an entire chess set in a pawn shop?
you can use the mid function.
to get the fourth letter i believe you would do in this format mid(stringname, startingpoint, length to take)
so you would do Mid(StrName, 4, 1) that will get you the fourth letter.
if you do Mid(StrName, x, 1) it in a for loop from 1 to string length for the x you will go through each letter.
DiGiTaIErRoR
Jan 22nd, 2000, 11:00 AM
If you want to actually select it (highlight)
do this:
Text1.SelStart = 1
Text1.SelLength = 3
Where if using Mid you'ld:
Mid$(Str$,SelStart,SelLength)
The first selects it like selecting and highlighting with the mouse.
The second sets it to a varible without highlighting or you could do both.
------------------
DiGiTaIErRoR
vbforums.com
Copyright Internet.com Inc., All Rights Reserved.