vb: how to find character position in string?
Website Design
Website Promotion
Graphic Design
Programming
Free Software
Computer Tips
Discount Stores
|
This site provides users with the information about vb, visual basic, vb6, find character position in string, how to find character position in string, how to use instr, how to use instrrev, and more.
If you think that this site is helpful, please recommend your friends to visit our site.
How to find character position in a string?
The following is the code for how to find character position in a string. It is very simple. You can just use the Instr or InstrRev functions:
1. Use Instr function
dim s as string
dim p as integer
s = "This is - what he said"
p = InStr(4, s, "i")
"p" shows 6 'The position of the second "i"
2. Use InstrRev function (Reversed count)
dim s as string
dim p as integer
s = "what he said"
p = InStrRev(s, "a", 4)
"p" shows 3 'starting 4th position to search reversely.
|