www.icetips.com  Icetips Utilities Documentation 6/29/2015    

String Class:  SplitString

Previous  Top  Next  


Prototype: (String pS, String pDelimiter, BYTE pDelimiterStartsLine=FALSE),Long,PROC

 

pSString to split
pDelimiterDelimiter to use to split the string
pDelimiterStartsLineIndicates that the delimiter is the start of the line, not end of it.  Defaults to FALSE.  2015-06-23

 

ReturnsNumber of lines created from the split string

 

This method is primarily used to split a string containing linebreaks into a queue of lines.  But it can also be used to separate text based on other delimiters.

 

Example:

ITS  ITStringClass

S    String(1024)

I    Long

Code

S = 'Icetips Creative, Inc.<13,10>136 E. 8th Street<13,10>Port Angeles, WA 98362'

ITS.SplitString(S,'<13,10>)

Loop I = 1 To Records(ITS.Lines)

  Message('Line ' & I & ITS.GetLine(I))

End

 

! Example showing where a delimiter starts the line

S ='SVM2,"1","1"' &|

    'SVM2,"1","2"' &|

    'SVM2,"1","2"'

ITS.SplitString(S,'SVM2',TRUE)

ITS.ODS('Lines: ' & Records(ITS.Lines))

Loop I = 1 To Records(ITS.Lines)

   Get(ITS.Lines,I)

   ITS.ODS('Line ' & Format(I,@n02) & ' ' & ITS.Lines.OL)

End

 

This would show 3 records in the ITS.Lines queue.

 

 

See also:

Lines

StringToLines

StringToWords



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