Susan wrote:
But if I want to get the last three number or the mid numbers of the string,
in CASL,I can use the right or mid function.
How can I  accomplish this?
If you like using those functions, you should probably write them yourself. eh, I'll get you started. left is just functionizing what Danny wrote.

void left( char *dest, const char *src, int len ) {
StrNCopy( dest, src, len );
dest[len] = 0;
}

void mid( char *dest, const char *src, int start, int len )
{
StrNCopy( dest, src+start, len );
dest[len] = 0;
}

void right ( char *dest, const char *src, int len ) {
int start;
start = StrLen(src) - len;
StrNCopy( dest, src + start, len );
dest[len] = 0;
}

something like those anyway. keep in mind that the dest memory must be allocated before passing the pointer to the functions.

matt


"Danny Wong" <[EMAIL PROTECTED]> wrote in message
news:110991@palm-dev-forum...

hi,

you can use StrNCopy() function.

Char * StrNCopy(Char *dst, const Char *src, Int16 n)

eg:

char *dest = NewPtrNew(10);
StrNCopy(dest, "ABC123", 3);

dest will contain "ABC"

regards,


--
For information on using the Palm Developer Forums, or to unsubscribe, please see http://www.palmos.com/dev/support/forums/

Reply via email to