www.icetips.com  Icetips Utilities Documentation 1/25/2016    

String Class:  ParseDelimtedLine

Previous  Top  Next  


Prototype: (STRING pLine, STRING pDelimiter, BYTE pRemoveQuotes=TRUE,<STRING pQuote>)!!,LONG,PROC

 

pLineThe line to parse
pDelimiterDelimeter to search for
pRemoveQuotesIf TRUE it removes the pQuote character from the first and last position in the word(s)
pQuoteQuote character to look for and remove.  Defaults to double quote (")
ReturnsReturns number of "words" parsed out of the pLine string.

 

This method takes a string with a single line of delimited data and parses it into the Words queue.  Please note the wrong spelling of delimited in the method name.  In January 2016, we added a correctly spelled method, ParseDelimitedLine, that simply calls this method. 

 

Example:

 

Given a file called Test.txt:

"Name","Title","FirstName","MI","LastName","Empty","Address","City","State"

"Mr. Terry Gilley","Mr.","Terry","","Gilley","","1425 N Field St   Apt 1111","Austin","TX"

"Mr. John Davis","Mr.","John","","Davis","","1825 Adolph St","El Paso","TX"

 

Program

Map

End

Include('ITUtilityClass.inc'),ONCE

 

 

FN  CString(1025)

ITS  ITStringClass

I    Long

Code

FN = 'Test.txt'

ITS.FileToString(FN)

ITS.ODS('File len: ' & Len(ITS.FileString))

ITS.StringToLines(ITS.FileString)

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

Loop I = 1 To Records(ITS.Lines)

  Get(ITS.Lines,I)

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

  ITS.ParseDelimtedLine (ITS.Lines.OL, ',',,'"')

End

 

Would yield 3 lines and each line would be parsed into 9 words or records in the ITS.Words queue. 

 

See also:

ParseCSVLine

FileToString

StringToLines

 

 



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