www.icetips.com  Icetips Utilities Documentation 9/18/2009    

String Class:  StringToWords

Previous  Top  Next  


Prototype: (String pS, Byte pCount=True, Byte pCaseSensitive=False, Byte pSort=True),Long,PROC

 

pSString to parse into words
pCountReserved
pCaseSensitiveIndicates if the case of the string should be preserved.  Set to false by default, meaning that all words are lower case
pSortIf true the words are sorted alphabetically.  If false the words are not sorted and are added in order so the words in the queue are in the same order as they are in the string.

 

ReturnsReturns the number of words in the string

 

This method is used to parse a string into words.  First all punctuation is removed by using the DepunctuateString method.  Note that ONLY unique words are stored along with a word counter, so this is not suitable for parsing words in order to put the text back together.  This is very useful to get words out of a document and count each occurance of it in the document.

 

NOTE: On September 18, 2009 the 4 parameter was added to make it possible to extract a non-sorted list of the words in the string.

 

Example:

ITS  ITStringClass

S    String(1024)

I    Long

Code

S = 'This and that is this'

ITS.StringToWords(S)

 

This would result in 4 words being added to the Words queue, "this", "and", "that" and "is" and the word "this" would have a count of 2 while the others would have a count of 1.

 

 

See also:

Words

ITWordQ

DepunctuateString

SetDepunctuationString

DepunctuationString

 



Direct link to this page: http://www.icetips.com/manuals/utilities/stringtowords_stringclass.htm