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
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.
_
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
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")
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
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,
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
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
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
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
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
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
12 matches
Mail list logo