|
-
October 11th, 2001, 09:21 AM
#1
Get char occurance count
Hello-
What is the fastest way to determine if there are more than 1 "*" characters in a string?
Thanks - Pipe
-
October 11th, 2001, 09:27 AM
#2
Re: Get char occurance count
If you are using VB 6.0, the quickest way is to use the Split command with the "*" as the delimiter like so
private Sub Command1_Click()
Dim strString
Dim strArray
strString = "**********"
strArray = Split(strString, "*")
MsgBox UBound(strArray) + 1
End Sub
John G
-
October 11th, 2001, 09:35 AM
#3
Re: Get char occurance count
split function with "*" as delimiter should be quite fast (I think more than instr function in a loop for the len of the string exiting when not found anymore).
You will receive an array with ubound = number of "*" char -1.
Maybe you could do some fancy tricks with binary data and Copymemory Api, but these are not my best way of working...
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
-
October 11th, 2001, 09:41 AM
#4
Re: whooops!
Beated in speed by you.
Sorry for my redundance, King.
;-)
Have a nice day, J.G.D.
Special thanks to Lothar "the Great" Haensler, Tom Archer, Chris Eastwood, TCartwright, Bruno Paris, Dr_Michael
and all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
The Rater
...at present time, using mainly Net 4.0, Vs 2010
Special thanks to Lothar "the Great" Haensler, Chris Eastwood , dr_Michael, ClearCode, Iouri and
all the other wonderful people who made and make Codeguru a great place.
Come back soon, you Gurus.
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
|