IonicWind Software

Aurora Compiler => General Discussion => Topic started by: Rock Ridge Farm (Larry) on January 13, 2006, 07:39:54 PM

Title: Does Auora have a string compare function?
Post by: Rock Ridge Farm (Larry) on January 13, 2006, 07:39:54 PM
I need a string compare function - does one exist?
Title: Re: Does Auora have a string compare function?
Post by: Ionic Wind Support Team on January 13, 2006, 07:41:45 PM
Yes.  Just use any of the normal comparison operators.

A = "hello"
b = "hello"

IF a = b
   Writeln("hello!");

You can also use > and < to see if a string is alphabetically less than or greater than.
Title: Re: Does Auora have a string compare function?
Post by: Rock Ridge Farm (Larry) on January 13, 2006, 07:47:41 PM
As usual it was my dumb mistake.

I was doing the following:
    if(struct.string = buffer)
I was getting a compile error but I realized that buffer was declared *buffer.
Changed to just buffer and now it compiles but seems to fail on the compare.
I will put some debug statements in the code and see why.
Title: Re: Does Auora have a string compare function?
Post by: Parker on January 13, 2006, 07:51:03 PM
You mean the buffer was a pointer? Try
if (SomeStruct.Str = *buffer)
Always make sure your types match up. Comparing a string to a pointer won't compile. Comparing an integer to a pointer will compile, but will most likely fail since the integer won't hold the same value as the address the pointer holds.