char *inputstring;

while(inputstring && inputstring[0])
{
   char *x=StrChr(inputstring,chrColon);
   if(x)        
   {
        //you can process substring betweein inputstring and x
        //for example
        //   char *word=(char *)MemPtrNew(x-inputstring);
        //   StrNCopy(word,inputstring,x-inputstring);
        //   word[x-inputstring-1]=0;
        //   do anything you want with word
        //   MemPtrFRee(word);
        inputstring=x+1;
   }
   else
   {
        //you can process last portion of string from inputsring
        inputstring=NULL;
   }
}




Ken Hoyes wrote:
> I am trying to parse strings of data read from a text file and 
> can't find a way to do it.
> 
> The data can be divided with any suitable character - a colon
> for instance.
> 
> I see how to iterate through the string looking for chrColon but
> then what?
> 
> If I find chrColon at position i and j of str1, how do I then make
> str2 a sub-string of the characters between i and j?
> 
> I found a net-page on String Constructors in C++ that provide
> functions including
> 
>      string str1(str2,11,4) 
> 
> but the word "string" is not recognised in PODS.  I tried including
> the line
> 
>      #include <string> 
> 
> as was used in the article I found at
> http://www.cppreference.com/cppstring/string_constructors.html
> but that generated errors by the 1000 when building the Palm
> application.
> 
> Surely I must be missing something obvious, there has to be an 
> easy way of doing this.
> 

-- 
For information on using the ACCESS Developer Forums, or to unsubscribe, please 
see http://www.access-company.com/developers/forums/

Reply via email to