|
-
May 3rd, 2001, 09:37 PM
#1
seacrching for a specified text from a string.
Hi all,
i have this problem... i don't have any idea on how to search or find or findout what is in a string. For instance i have a string '123' and i want to know whether the string '123' contains a '2'.... it must sound simple but i've tried everything i know and still can't get it. pls...help...me..
-
May 3rd, 2001, 10:10 PM
#2
Re: seacrching for a specified text from a string.
try this
dim s as string
dim l as long
s = "123"
l = instr(1,s,"2") 'should return 2 to l, the position where the char "2" occur
s = "123"
l = instr(1,s,"4") 'should return 0 to l, as no char "4" found in string s.
HTH
cksiow
http://vblib.virtualave.net - share our codes
-
May 4th, 2001, 10:56 PM
#3
Re: seacrching for a specified text from a string.
Hello:
You can also do this: You can textbox and Richtextbox to find String.
RichTextBox2.UpTo (Text1.Text)
RichTextBox2.SetFocus
However, the cursor must before the String to be searched.
You can find more information about it on the Visual Basic 6:Black Book by Steven Holzner.
Good Luck
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|