Nigel Grant wrote:
My string contains a phone number & a name eg. "me | +61 (0) 408 409 409"
I want to have two string variables that contain "me" & "+61 (0) 408 409 409"
Should I use StrChr or StrStr ?
I have tried to write my own, I'm having trouble as these are pointers not values.
An example piece of code that I can study would be ideal :)
Let's say strTemp is the pointer to your original string. We will make a copy of this string, find the "|" and alter the string to get two pointers to the start of the first substring (strSub1) and the second substring (strSub2).
Char *strSub1, *strSub2;
strSub1 = MemPtrNew(StrLen(strTemp) + 1);
if (strSub1)
{
StrCopy(strSub1, strTemp);
strSub2 = StrChr(strSub1, '|');
if (strSub2)
{
strSub2[0] = 0;
strSub2++;
// strSub1 has now the first substring, strSub2 the second, use it
// here
}
MemPtrFree(strSub1);
}
Regards Henk
-- ------------------------------------------------------------------------- Henk Jonas [EMAIL PROTECTED] Palm OS � certified developer
Please contact me, if you need an off-side contract worker. -------------------------------------------------------------------------
-- For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/
