----- Original Message ----- 
From: "D. Kirker" <[EMAIL PROTECTED]>
Newsgroups: palm-dev-forum
To: "Palm Developer Forum" <[EMAIL PROTECTED]>
Sent: Monday, April 05, 2004 7:32 PM
Subject: Re: find offset of character in string


> I had done a Google search on "StrStr" and found a little example like
what
> Vu Pham posted.
>
> Thanks for the help,
> D. Kirker
>
> P.S. How could I delete the character at the offset found with StrStr and
> all the characters to the end of the string?


If you search for a char, then it is better to use StrChr. If you search for
a str, then use StrStr.

If pend points to the found offset, then *(pend+1) will "delete" the rest of
the string.
If you really want to clear all chars after pend, then put 0x0 to each char
since pend+1 until the end of the original str.


Vu


>
> "Ben Combee" <[EMAIL PROTECTED]> wrote in message
> news:[EMAIL PROTECTED]
> > At 07:33 PM 4/4/2004, you wrote:
> > >How do I find the offset of a character (or string) in a string and
> return
> > >it as an int?
> >
> > Hint #1: Read the String Manager chapter of the Palm OS SDK reference.
> > Hint #2: Think of how you would do it using the standard C library, then
> > look for similar functions.
> >
> > -- Ben Combee, senior DTS engineer, PalmSource, Inc.
> >     Read "Combee on Palm OS" at http://palmos.combee.net/
> >
> >
> >
>
>
>
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/
>
>



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

Reply via email to