Re: comparing strings

2002-01-29 Thread Collins, Joe (EDSI\\BDR)
Worth reading, including the end where Jonathan expands on his earlier post. -Original Message- From: Jonathan E. Paton [mailto:[EMAIL PROTECTED]] Sent: Tuesday, January 29, 2002 1:32 PM To: Collins, Joe (EDSIBDR) Subject: RE: Comparing strings | > Don't know if this helps,

Re: Comparing strings

2002-01-29 Thread Crash Dummy
how much beginning does it take for one to officially become a beginner? these double colons are looking quite fancy... crashdude® --- Chris Zampese <[EMAIL PROTECTED]> wrote: > me again :) > > Just realised that I did not give you an > explanation of why this works... > > The expression

Re: Comparing strings

2002-01-29 Thread ekayes
I was going to try: if (uc($one) eq uc($two)){ etc. But will this be okay with non-alphabetic characters? "Jonathan E. Paton" <[EMAIL PROTECTED]> on 01/29/2002 11:42:52 AM To: [EMAIL PROTECTED] cc: Subject: Re: Comparing strings > Don't know if this

Re: Comparing strings

2002-01-29 Thread Jonathan E. Paton
> Don't know if this helps, but the following code > > $one = "ExamPle"; > $two = "example"; > > if ($one=~/$two/i) { > print "true "; > } > This is a bad idea for anything other than throwaway scripts... it requires building a full regex everytime (from $two). You *MUST* use quotemeta()

Re: Comparing strings

2002-01-29 Thread Chris Zampese
me again :) Just realised that I did not give you an explanation of why this works... The expression is a simple regex (see Perl Documentation). The =~ is sort of the 'equal to' part, and the i at the end makes the comparison case insensitive. -- To unsubscribe, e-mail: [EMAIL PROTECTED]

Re: Comparing strings

2002-01-29 Thread Chris Zampese
dont know if this helps, but the following code $one = "ExamPle"; $two = "example"; if ($one=~/$two/i) { print "true "; } print "false"; outputs: true false (ie evaluates the expression in the curly braces) and if you change the top word to ExanPle (change the m to n) then it only outputs:

Re: Comparing strings

2002-01-29 Thread Sudarsan Raghavan
[EMAIL PROTECTED] wrote: > Hi > > I wish to do string comparisons where the case is ignored, for example: > > $one = "ExanPle"; > $two = ""example"; > > if ($one eq $two){ > THIS RETURNS TRUE if (lc($one) eq lc($two)) { #perldoc -f lc HTH, Sudarsan > > > What do I add s

Re: comparing strings

2001-06-22 Thread Jos I. Boumans
yeah, rub it in... i already corrected it... not sure *what* i was thinking... br4n3 fry... SORRY =) - Original Message - From: "Paul" <[EMAIL PROTECTED]> To: "Jos I. Boumans" <[EMAIL PROTECTED]> Cc: <[EMAIL PROTECTED]> Sent: Friday, June 22

Re: comparing strings

2001-06-22 Thread Paul
--- "Jos I. Boumans" <[EMAIL PROTECTED]> wrote: > stricly speaking 'foo' == 'bar' since both should yield 3. er? print int('foo'); # prints 0 __ Do You Yahoo!? Get personalized email addresses from Yahoo! Mail http://personal.mail.yahoo.com/

Re: comparing strings

2001-06-22 Thread Jos I. Boumans
to prove i sometimes write utter non sence too after a long week: 'foo' == 'bar' is true because they are both ZERO, not because their length is both 3 'bar' == 'quux' too, etc my humble apologies... > i'm not sure i follow where you want to go... > are you trying to compare ascii value? or len

Re: comparing strings

2001-06-22 Thread Jos I. Boumans
i'm not sure i follow where you want to go... are you trying to compare ascii value? or length of a string? stricly speaking 'foo' == 'bar' since both should yield 3. and if you want to compare on a being in the alphabet before b, you'd want something like: if (a lt b) { print "foo" } perldoc p

Re: comparing strings

2001-06-22 Thread Peter Scott
At 02:30 PM 6/22/01 -0500, Nick Transier wrote: >Does anyone know a way to make boolean comparisons between strings? >For example, I want 'a' < 'b' to be true 'a' lt 'b' >, but perl says 'a' == 'b' is true. 'a' eq 'b' is false 'a' == 'b' is true because each string is interpreted in a numeric

RE: comparing strings

2001-06-22 Thread Wagner-David
You are using numeric comparsion when you want string(change to lt (less than), le (less than and equal), etc. so 'a'< 'b' should be 'a' lt 'b' Wags ;) -Original Message- From: Nick Transier [mailto:[EMAIL PROTECTED]] Sent: Friday, June 22, 2001 12:31 To: [EMAIL PROTECTED] Sub

RE: comparing strings

2001-06-22 Thread Kipp, James
I think : "a" cmp "b" ; # -1 ab > -Original Message- > From: Nick Transier [mailto:[EMAIL PROTECTED]] > Sent: Friday, June 22, 2001 3:31 PM > To: [EMAIL PROTECTED] > Subject: comparing strings > > > Does anyone know a way to make boolean comparisons between strings? > For example, I wan

Re: comparing strings

2001-06-22 Thread Paul
--- Nick Transier <[EMAIL PROTECTED]> wrote: > Does anyone know a way to make boolean comparisons between strings? > For example, I want 'a' < 'b' to be true, but perl says 'a' == 'b' is > true. Use the string comparators. =o) 'a' lt 'b' 'a' == 'b' is true because they're both zero. 'a' eq 'b'