From: Hans-Bernhard Broeker Newsgroups: comp.os.msdos.djgpp Subject: Re: strings i think...? Date: 29 Jan 2001 13:38:53 GMT Organization: Aachen University of Technology (RWTH) Lines: 28 Message-ID: <953rpd$nft$1@nets3.rz.RWTH-Aachen.DE> References: NNTP-Posting-Host: acp3bf.physik.rwth-aachen.de X-Trace: nets3.rz.RWTH-Aachen.DE 980775533 24061 137.226.32.75 (29 Jan 2001 13:38:53 GMT) X-Complaints-To: abuse AT rwth-aachen DOT de NNTP-Posting-Date: 29 Jan 2001 13:38:53 GMT Originator: broeker@ To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com [Note: this problem is almost entirely unrelated to DJGPP --- nor even to any particular programming language, either. You had better asked about it elsewhere.] D Borland wrote: [...] > user types: 'bike green suzuki' > programs string: 'green bike suzuki' ... and you want these two strings to compare as 'equal', right? In that case, you'll want to preprocess both strings before comparing them. One way would be to split each into a list of words, and sort that list alphabetically. Then you can either concatenate those words again, to form a new single string, or keep storing them as a sorted list of individual strings (can be pointers into the original string, if you kept that). Then, you can do the comparison by using strcmp() on the sorted lists, element by element. Due to the sorting, both of the above inputs would end up as "bike", "green", "suzuki" and thus compare equal. -- Hans-Bernhard Broeker (broeker AT physik DOT rwth-aachen DOT de) Even if all the snow were burnt, ashes would remain.