RSS/Atom feed Twitter
Site is read-only, email is disabled

string compare in script-fu (gimp1.2.3)

This discussion is connected to the gimp-user-list.gnome.org mailing list which is provided by the GIMP developers and not related to gimpusers.com.

This is a read-only list on gimpusers.com so this discussion thread is read-only, too.

3 of 4 messages available
Toggle history

Please log in to manage your subscriptions.

string compare in script-fu (gimp1.2.3) Lajos Kamocsay 14 Apr 23:52
  string compare in script-fu (gimp1.2.3) GSR - FR 15 Apr 00:17
20040414220201.GA21182@brog... 07 Oct 20:16
  string compare in script-fu (gimp1.2.3) Lajos Kamocsay 15 Apr 07:12
Lajos Kamocsay
2004-04-14 23:52:35 UTC (about 20 years ago)

string compare in script-fu (gimp1.2.3)

Hello,

I'd like to compare a string variable to a constant string in script fu using gimp 1.2.3, but I can't figure out how.

Here's what I tried in the console:

=> (set! a "hello") ; set a to "hello" "hello"

=> a ; check value of a "hello"

=> (= a "hello") ; check if a = "hello" ()

=> (= a "nothello") ; check if a = "nothello" ()

Script-fu always returns () instead of a true value.

What am I missing?

Thanks, Lajos

---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.

GSR - FR
2004-04-15 00:17:37 UTC (about 20 years ago)

string compare in script-fu (gimp1.2.3)

lists@panka.com (2004-04-14 at 1452.35 -0700):

What am I missing?

Try (equal? a "hello"). When coding, have a language reference handy, like http://www.cs.indiana.edu/scheme-repository/imp/siod.html.

GSR

Lajos Kamocsay
2004-04-15 07:12:47 UTC (about 20 years ago)

string compare in script-fu (gimp1.2.3)

Thanks for all the replies.

I also found the strcmp function which does a string compare.

Thanks,
Lajos

Quoting Jeffrey Brent McBeth :

On Wed, Apr 14, 2004 at 02:52:35PM -0700, Lajos Kamocsay wrote:

Hello,

I'd like to compare a string variable to a constant string in script fu using gimp 1.2.3, but I can't figure out how.

IIRC, the function you are looking for is

equal?

A often made mistake in LISP/Scheme dialects is to assume that =, eq, eqv, equal mean the same thing.

= is comparing the objects and the object a and the object "hello" are definitely not the same thing.

equal? will step through the collection and test for equivalent objects (all the characters are the same)

Jeff

Here's what I tried in the console:

=> (set! a "hello") ; set a to "hello" "hello"

=> a ; check value of a "hello"

=> (= a "hello") ; check if a = "hello" ()

=> (= a "nothello") ; check if a = "nothello" ()

Script-fu always returns () instead of a true value.

What am I missing?

Thanks, Lajos

---------------------------------------------------------------- This message was sent using IMP, the Internet Messaging Program.