Case difference in string comparisons

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
6 messages Options
Reply | Threaded
Open this post in threaded view
|

Case difference in string comparisons

Cesar Rabak
According to the VW help for Characters and Strings at Compare by
sorting order: "Case differences make two strings unequal but not less
than or greater than each other."

However if we take the example (just below the quoted text):

| str1 str2 str3 |

str1 := 'north'.
str2 := 'North'.
str3 := 'northwest'.

When evaluating:

str1 = str2 returns false
str1 < str2 returns false
str1 > str2 returns true

Last result contradicts the quoted text, or maybe I'm missing something?

--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/

Reply | Threaded
Open this post in threaded view
|

Re: Case difference in string comparisons

Dave Stevenson-2
The help text is wrong. Created AR 52328

Dave

Cesar Rabak wrote:

> According to the VW help for Characters and Strings at Compare by
> sorting order: "Case differences make two strings unequal but not less
> than or greater than each other."
>
> However if we take the example (just below the quoted text):
>
> | str1 str2 str3 |
>
> str1 := 'north'.
> str2 := 'North'.
> str3 := 'northwest'.
>
> When evaluating:
>
> str1 = str2 returns false
> str1 < str2 returns false
> str1 > str2 returns true
>
> Last result contradicts the quoted text, or maybe I'm missing something?
>

Reply | Threaded
Open this post in threaded view
|

Re: Case difference in string comparisons

Dennis smith-4
However, the point the text was trying to make (incorrectly) was that in
the sort order,
upper and lower case letters will sort mixed -- unlike most other
situations (languages) ...

For example, do the following
    #( 'abc' 'ABC' 'def' 'DEF' 'ghi' 'GHI' ) asSortedCollection
and you get
    a SortedCollection ( 'ABC'  'abc'  'DEF'  'def'  'GHI'  'ghi' )
where if you did a similar thing in C you would expect
    'ABC'  'DEF 'GHI'  'abc'  'def'  'ghi'
   

Dave Stevenson wrote:

> The help text is wrong. Created AR 52328
>
> Dave
>
> Cesar Rabak wrote:
>> According to the VW help for Characters and Strings at Compare by
>> sorting order: "Case differences make two strings unequal but not
>> less than or greater than each other."
>>
>> However if we take the example (just below the quoted text):
>>
>> | str1 str2 str3 |
>>
>> str1 := 'north'.
>> str2 := 'North'.
>> str3 := 'northwest'.
>>
>> When evaluating:
>>
>> str1 = str2 returns false
>> str1 < str2 returns false
>> str1 > str2 returns true
>>
>> Last result contradicts the quoted text, or maybe I'm missing something?
>>
>

--
Dennis Smith                         +1 416.798.7948
Cherniak Software Development Corporation   Fax: +1 416.798.0948
509-2001 Sheppard Avenue East        [hidden email]
Toronto, ON M2J 4Z8              sip:[hidden email]
Canada         http://www.CherniakSoftware.com
Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP

Reply | Threaded
Open this post in threaded view
|

Re: Case difference in string comparisons

Dave Stevenson-2
Oh thanks. I couldn't figure out the original intent of the text for the
life of me, but that at least is a sensible explanation.

Dave

Dennis Smith wrote:

> However, the point the text was trying to make (incorrectly) was that in
> the sort order,
> upper and lower case letters will sort mixed -- unlike most other
> situations (languages) ...
>
> For example, do the following
>    #( 'abc' 'ABC' 'def' 'DEF' 'ghi' 'GHI' ) asSortedCollection
> and you get
>    a SortedCollection ( 'ABC'  'abc'  'DEF'  'def'  'GHI'  'ghi' )
> where if you did a similar thing in C you would expect
>    'ABC'  'DEF 'GHI'  'abc'  'def'  'ghi'
>  
> Dave Stevenson wrote:
>> The help text is wrong. Created AR 52328
>>
>> Dave
>>
>> Cesar Rabak wrote:
>>> According to the VW help for Characters and Strings at Compare by
>>> sorting order: "Case differences make two strings unequal but not
>>> less than or greater than each other."
>>>
>>> However if we take the example (just below the quoted text):
>>>
>>> | str1 str2 str3 |
>>>
>>> str1 := 'north'.
>>> str2 := 'North'.
>>> str3 := 'northwest'.
>>>
>>> When evaluating:
>>>
>>> str1 = str2 returns false
>>> str1 < str2 returns false
>>> str1 > str2 returns true
>>>
>>> Last result contradicts the quoted text, or maybe I'm missing something?
>>>
>>
>

Reply | Threaded
Open this post in threaded view
|

Re: Case difference in string comparisons

Bruce Boyer
In reply to this post by Dennis smith-4
Cases of this kind of error in the doc are always interesting to me, because I wonder when the error entered (and desperately hope it wasn't my fault).  This one, in fact, dates to the Cookbook.  See p. 541 of the version that shipped with VW 2.5.

There's an AR, and it will be  corrected.  More than corrected, maybe say something enlightening.  

Bruce

----- Original Message -----
From: "Dennis Smith" <[hidden email]>
To: <[hidden email]>
Sent: Friday, June 01, 2007 3:33 AM
Subject: Re: Case difference in string comparisons


| However, the point the text was trying to make (incorrectly) was that in
| the sort order,
| upper and lower case letters will sort mixed -- unlike most other
| situations (languages) ...
|
| For example, do the following
|    #( 'abc' 'ABC' 'def' 'DEF' 'ghi' 'GHI' ) asSortedCollection
| and you get
|    a SortedCollection ( 'ABC'  'abc'  'DEF'  'def'  'GHI'  'ghi' )
| where if you did a similar thing in C you would expect
|    'ABC'  'DEF 'GHI'  'abc'  'def'  'ghi'
|  
|
| Dave Stevenson wrote:
| > The help text is wrong. Created AR 52328
| >
| > Dave
| >
| > Cesar Rabak wrote:
| >> According to the VW help for Characters and Strings at Compare by
| >> sorting order: "Case differences make two strings unequal but not
| >> less than or greater than each other."
| >>
| >> However if we take the example (just below the quoted text):
| >>
| >> | str1 str2 str3 |
| >>
| >> str1 := 'north'.
| >> str2 := 'North'.
| >> str3 := 'northwest'.
| >>
| >> When evaluating:
| >>
| >> str1 = str2 returns false
| >> str1 < str2 returns false
| >> str1 > str2 returns true
| >>
| >> Last result contradicts the quoted text, or maybe I'm missing something?
| >>
| >
|
| --
| Dennis Smith                          +1 416.798.7948
| Cherniak Software Development Corporation   Fax: +1 416.798.0948
| 509-2001 Sheppard Avenue East        [hidden email]
| Toronto, ON M2J 4Z8              sip:[hidden email]
| Canada          http://www.CherniakSoftware.com
| Entrance off Yorkland Blvd south of Sheppard Ave east of the DVP
|

Reply | Threaded
Open this post in threaded view
|

Re: Case difference in string comparisons

Cesar Rabak
In reply to this post by Dennis smith-4
Dennis Smith escreveu:
 > However, the point the text was trying to make (incorrectly) was that in
 > the sort order,
 > upper and lower case letters will sort mixed -- unlike most other
 > situations (languages) ...
 >
 > For example, do the following
 >    #( 'abc' 'ABC' 'def' 'DEF' 'ghi' 'GHI' ) asSortedCollection
 > and you get
 >    a SortedCollection ( 'ABC'  'abc'  'DEF'  'def'  'GHI'  'ghi' )
 > where if you did a similar thing in C you would expect
 >    'ABC'  'DEF 'GHI'  'abc'  'def'  'ghi'
I see your point, and think it would be necessary more text and your
nice example to accompany the explanation.

Thanks and regards,


--
Cesar Rabak
GNU/Linux User 52247.
Get counted: http://counter.li.org/