Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!swrinde!ucsd!ucbvax!van-bc!ubc-cs!alberta!mts.ucs.UAlberta.CA!Al_Dunbar From: userAKDU@mts.ucs.UAlberta.CA (Al Dunbar) Newsgroups: comp.lang.c Subject: Re: Comparing strings... Message-ID: <1693@mts.ucs.UAlberta.CA> Date: 15 Oct 90 04:15:14 GMT References: <2205.271700c2@cc.nu.oz.au> Organization: MTS Univ of Alberta Lines: 28 In article <2205.271700c2@cc.nu.oz.au>, v8902058@cc.nu.oz.au writes: > > >Hello... > > I'm sorry if this is a trival task, but I would like a function that >compares two strings. I would like to be able to find if a string is equal to, >less than, or greater than another string. I tried writing a routinue myself, >but I just can't seem to do it, so I thought I'd ask. > > I wouldn't mind some code, or just the basic algorithm maybe. > > If anyone can help me, please email or post... > >Thanks. > >Bernard. If you have a C compiler, you probably already have such a function; just #include and then use routines such as strcmp, stricmp, and strncmp as probably defined in the manual. -------------------+------------------------------------------- Al Dunbar | Edmonton, Alberta | this space for rent CANADA | -------------------+-------------------------------------------