ASP Code

Mimic PHP's str_word_count() function with ASP

In PHP, you can use the str_word_count() function to take a string, and return to you the number of separate words within the string. Here's how we could duplicate it in ASP:

Function strWordCount( strToCount )
	Dim arWords

	strToCount   = Trim( strToCount & "" )
	arWords      = split( strToCount, " " )
	strWordCount = uBound( arWords ) + 1

End Function

Leave a Reply

Your email address will not be published. Required fields are marked *

To prove you're a person (not a spam script), type the security word shown in the picture. Click on the picture to hear an audio file of the word.
Anti-spam image