|
| |
|
|
seth
Posts: 312 From: canada Status: offline
|
check character in a string - 6/24/2007 4:08:37
Hi, I was wondering how i can check a string to see how many underscores it contains. I have two strings that have different number of underscores in them, one has 6 the other has 8. I need to do something base on the string's number of underscores. Thanks!
|
|
|
|
ou812
Posts: 1601 Joined: 1/5/2002 From: San Diego Status: offline
|
RE: check character in a string - 6/24/2007 12:59:17
I was thinking there must be an ASP function that does this, but I couldn't find one. The easiest way to do this, but probably not the most proper way is to split the string on the underscore into an array and then count the array. Something like: Count1 = UBound(Split(String1, "_")) Count2 = UBound(Split(String2, "_")) If you're going to do this many times you could make a function and pass it the variables, otherwise just executing twice, once for each string is fine. Otherwise, I guess you could walk through the sting character by character through a loop, using mid to pull out and compare each one against underscore. This might be the more proper way to do it, but it is more coding. I think I would just go with the array, and waste a bit more resources.
_____________________________
-brian EnterpriseDB: Enterprise-class relational database management system PostgreSQL: The world's most advanced open source database
|
|
New Messages |
No New Messages |
Hot Topic w/ New Messages |
Hot Topic w/o New Messages |
Locked w/ New Messages |
Locked w/o New Messages |
|
Post New Thread
Reply to Message
Post New Poll
Submit Vote
Delete My Own Post
Delete My Own Thread
Rate Posts
|
|
|