|
|
|
|
Counting the number of
occurences of a substring within a string using the Split and
UBound functions
If you are unfamiliar with the Split and UBound functions
you may want to read our tutorial on array
functions
<%
Dim myString, tempString,
iHowManyTimes
myString ="This is a test"
tempString = Split(myString,
"is")
iHowManyTimes = UBound(tempString)
Response.write "There are " & iHowManyTimes &
" occurences."
%>
Output: There are 2 occurences.
|
If you have any code snippets to share with full credit given then send an email to Codesnippets - You'll receive full credit and a link back to your site.
Site developed by Michael Wall - Web Design Belfast N.Ireland.
Copyright © 2000-2008. All rights reserved.
|
| |
|
|
|