Carlos,
You may try the following code. It trims both leading and trailing space.
However, you may modify it to suit your needs.
/***********************************************************************
* FUNCTION: StrTrim
* DESCRIPTION: This function trims all leading and trailing space of a string
* PARAMETERS: s - the source string
* RETURNED: The same string pointer with trimmed content
***********************************************************************/
Char *StrTrim(Char *s)
{
Char *p, *t;
p = s, t = s;
while (*p == ' ') // locate first non-space
p++;
while (*p != '\0') // copy string till the end
*t++ = *p++;
*t = '\0'; // mark string terminator
while (t != s && *(--t) == ' ') // push terminator back if there is
trailing space
*t = '\0';
return (s);
}
Regards,
Stephen Lee
-----Original Message-----
From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of Carlos Gonzalez
Sent: Tuesday, July 04, 2006 10:05 AM
To: Palm Developer Forum
Subject: Re: trim()
I am using C.
I just want to shift left the content of the string...
Thanks again,
Carlos
--
For information on using the PalmSource Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/