Re: [U2] Comparing numeric strings

2011-08-12 Thread Boydell, Stuart
Still not that elegant but the quote function worked for me. 0001 a = '401.0101' 0002 b = '401.0101000' 0003 crt 'equal ' :a = b 0004 crt 'quote ' :quote(a) = quote(b) 0005 crt 'comp ' :compare(a,b) Output: equal 1 quote 0 comp 1 Cheers, Stuart -Original Message- From: u2-users-boun...@l

[U2] AUTO: Keith Davison is out of the office. (returning 22/08/2011)

2011-08-12 Thread Keith Davison
I am out of the office until 22/08/2011. I will respond to your message when I return. Note: This is an automated response to your message "Re: [U2] Comparing numeric strings" sent on 12/08/2011 18:10:58. This is the only notification you will receive while this person is away. _

Re: [U2] Comparing numeric strings

2011-08-12 Thread Glorfield, Gordon
Unidata has no equivalent to the UV COMPARE function. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of u2ug Sent: Friday, August 12, 2011 1:20 PM To: U2 Users List Subject: Re: [U2] Comparing numeric strings Have you

Re: [U2] Comparing numeric strings

2011-08-12 Thread Rex Gozar
COMPARE() works, just be careful if you're using it for sorting strings. Compiling and running the following test program: GET(ARG.) A ELSE ABORT GET(ARG.) B ELSE ABORT X = COMPARE(A, B) IS.LESS.THAN = (X LT 0) DISPLAY (IF IS.LESS.THAN THEN "less" ELSE "greater"):" than" LOCATE(A, B; FOUND; "AL")

Re: [U2] Comparing numeric strings

2011-08-12 Thread u2ug
Have you looked at the COMPARE() function ? Does the trick under universe. -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Rob Sobers Sent: Friday, August 12, 2011 1:11 PM To: U2 Users List Subject: Re: [U2] Comparin

Re: [U2] Comparing numeric strings

2011-08-12 Thread Rob Sobers
Thanks all. I should have mentioned that I already knew about the alpha-concatenation hack. I was sort of looking for a cleaner approach. It looks like SCMP falls down on floating point numbers. That should probably be mentioned in the docs, but instead it just fails silently. ;-( -Rob On Fri,

Re: [U2] Comparing numeric strings

2011-08-12 Thread Rex Gozar
In July I added to PickWiki: http://www.pickwiki.com/cgi-bin/wiki.pl?UniVerse_Tips_And_Tricks#Forcing_string_comparison_on_numbers rex On Fri, Aug 12, 2011 at 8:15 AM, Rob Sobers wrote: > Say you have two strings that happen to be numeric: > > FOO = "401.0101" > BAR = "401.0101000" > > Since Un

Re: [U2] Comparing numeric strings

2011-08-12 Thread Keith Davison
Hi, I think the SCMP command is failing because of the decimal place. If you take that out you will see it work correctly. FOO = "401010" BAR = "40101000" CRT SCMP(FOO,BAR) -1 FOO = "401010" BAR = "401010" CRT SCMP(FOO,BAR) 0 FOO = "4010100" BAR = "401010" CRT SCMP(FOO,BAR) 1 SCMP RESUL

Re: [U2] Comparing numeric strings

2011-08-12 Thread Dave Laansma
Call me a hack ... go ahead "A":FOO < "A":BAR "Numeric string" is an oxymoron in any language, I believe. Sincerely, David Laansma IT Manager Hubbard Supply Co. Direct: 810-342-7143 Office: 810-234-8681 Fax: 810-234-6142 www.hubbardsupply.com "Delivering Products, Services and Innovative Solutio

Re: [U2] Comparing numeric strings

2011-08-12 Thread Perry Taylor
Try concatenating a non-numeric character to each.. IF FOO: 'X' EQ BAR: 'X' THEN Perry -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Rob Sobers Sent: Friday, August 12, 2011 6:15 AM To: U2 Users List Subjec

Re: [U2] Comparing numeric strings

2011-08-12 Thread Symeon Breen
Add a space to the end to force it as a string e.g. IF (FOO:' ') = (BAR:' ') -Original Message- From: u2-users-boun...@listserver.u2ug.org [mailto:u2-users-boun...@listserver.u2ug.org] On Behalf Of Rob Sobers Sent: 12 August 2011 13:15 To: U2 Users List Subject: [U2] Comparing numeri

[U2] Comparing numeric strings

2011-08-12 Thread Rob Sobers
Say you have two strings that happen to be nuneric: FOO = "401.0101" BAR = "401.0101000" Since UniBasic is untyped, even though I've wrapped each value in quotes "", they are treated as numbers. As a result, FOO EQ BAR evaluates to @TRUE. In most dynamically typed languages, there's an intuitiv