[Coco] "C string searching question
Retro Canada
retrocanada76 at gmail.com
Tue Oct 2 01:13:05 EDT 2012
use strcmp compare the result to 0. 0 means equal
but the performance of your alrgorithm is bad O(x^2) this pretty means
Sent from my iPhone
On 2012-10-02, at 1:06 AM, Bill Pierce <ooogalapasooo at aol.com> wrote:
>
> Mark,
> I just did some searching through klib.l manual and the string functions there are:
>
> strcat, strucat, strncat, strcmp, strucmp, strncmp, struncmp, strcpy, strucpy, strncpy, strlen, strchr, strrchr, strpbrk, strspn, strcspn, strtok, strclr, strend, reverse, pwcryp, index, rindex
>
> there's no strstr.
>
> Bill P
>
> Music from the Tandy/Radio Shack Color Computer 2 & 3
> https://sites.google.com/site/dabarnstudio/
> Bill Pierce
> ooogalapasooo at aol.com
>
>
>
>
> -----Original Message-----
> From: Mark McDougall <msmcdoug at iinet.net.au>
> To: CoCoList for Color Computer Enthusiasts <coco at maltedmedia.com>
> Sent: Tue, Oct 2, 2012 12:37 am
> Subject: Re: [Coco] "C string searching question
>
>
> On 2/10/2012 2:01 PM, Bill Pierce wrote:
>
>> <I don't suppose you have access to library functions like strlen() and
>> <strchr() and strstr() in that context, do you?
>>
>> Yes, they are supported.
>
> Replace the inner loop with:
> if (strstr (records[cnt].recname, srchstr))
>
> Regards,
>
> --
> | Mark McDougall | "Electrical Engineers do it
> | <http://members.iinet.net.au/~msmcdoug> | with less resistance!"
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
>
>
>
> --
> Coco mailing list
> Coco at maltedmedia.com
> http://five.pairlist.net/mailman/listinfo/coco
More information about the Coco
mailing list