www.icetips.com  Icetips Utilities Documentation 7/6/2014    

String Class:  CompactString

Previous  Top  Next  


Prototype: (String pOriginal, Byte pUpperCase=False),String

 

pOriginalString to compact
pUpperCaseIndicates if the resulting string should be uppercased as well.

 

ReturnsThe pOriginal string with all spaces and puncuation removed

 

This method removes all spaces and punctuation from a string.  This can be very useful to create strings for sorting queues or tables where punctuation and spaces should not affect the sorting order.  It is also very convenient when comparing strings where spaces and punctuation may differ, but the text is the same.  This method calls the DepunctuateString method to remove punctuation.  The call to DepunctuateString allows numbers to be included so that only punctuation characters are removed.  See also SetDepunctuationString method and Construct methods for more information about punctuation characters.

 

Example:

ITS  ITStringClass

S1   String(100)

S2   String(100)

Code

S1 = 'Arnor Baldvinsson, Icetips  Creative, Inc.'

S2 = 'Arnor  Baldvinsson Icetips Creative. inc.'

If ITS.CompactString(S1) = ITS.CompactString(S2)

  !! Text of strings match

End

 

In this example the compact versions of the S1 and the S2 strings match, even though the spaces and punctuation makes the different.

 

 

See also:

DepunctuateString

SetDepunctuationString

Construct



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