Published in: ASP
URL: http://reusablecode.blogspot.com/2008/10/wordcount.html
<% ' Copyright (c) 2008, reusablecode.blogspot.com; some rights reserved. ' ' This work is licensed under the Creative Commons Attribution License. To view ' a copy of this license, visit http://creativecommons.org/licenses/by/3.0/ or ' send a letter to Creative Commons, 559 Nathan Abbott Way, Stanford, California ' 94305, USA. ' Count the number of words in a string. function WordCount(byVal someString) dim position dim spaces spaces = 1 someString = trim(someString) for position = 1 to len(someString) if mid(someString, position, 1) = " " and not mid(someString, position - 1, 1) = " " then spaces = spaces + 1 end if next WordCount = spaces end function %>
You need to login to post a comment.
