October 29, 2025, 07:11:56 AM

News:

IWBasic runs in Windows 11!


Does Auora have a string compare function?

Started by Rock Ridge Farm (Larry), January 13, 2006, 07:39:54 PM

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

Rock Ridge Farm (Larry)

I need a string compare function - does one exist?

Ionic Wind Support Team

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.
Ionic Wind Support Team

Rock Ridge Farm (Larry)

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.

Parker

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.