I want to sort numbers:
2,13,3,32...etc.
I can remember the second part...
if char(1) of x = 0 then
delete char(1) of x
but the first part, putting the zero before the
single digit numbers escapes me and I can't
find the appropriate thing in the dictionary.
Something Else I've Forgotten
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller
Something Else I've Forgotten
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.
Programming powered by coffee.
Re: Something Else I've Forgotten
Don't know if I understand what you really want to do... but to put noughts in front of single numbers
Code: Select all
on mouseUp
repeat with count = 1 to the number of lines of fld 1
if the number of chars of line count of fld 1 = 1 then
put 0 & line count of fld 1 into line count of fld 1
end if
end repeat
end mouseUp
Re: Something Else I've Forgotten
I am with Dixie.
You asked about sorting, and then asked about prepending a "0' to single digit numbers. If those two points are related, know that LC will sort "03" with the same rank as "3". That is, if either precedes the other in a list, and you sort numeric, those two elements will retain their positions.
Prepending a "0" may have other uses, if, say, it is desired that all the elements have the same length, for whatever reason.
But please tell us again what you are asking...
Craig Newman
You asked about sorting, and then asked about prepending a "0' to single digit numbers. If those two points are related, know that LC will sort "03" with the same rank as "3". That is, if either precedes the other in a list, and you sort numeric, those two elements will retain their positions.
Prepending a "0" may have other uses, if, say, it is desired that all the elements have the same length, for whatever reason.
But please tell us again what you are asking...
Craig Newman
Re: Something Else I've Forgotten
Yes, you're right but perhaps it wasn't always so?
My mistake was in coding it as
"sort the items of field x ascending"
rather than simply
"sort field x ascending numeric"
Thanks for your help.
My mistake was in coding it as
"sort the items of field x ascending"
rather than simply
"sort field x ascending numeric"
Thanks for your help.
Is age an excuse? Eighty-four and counting.
Programming powered by coffee.
Programming powered by coffee.
Re: Something Else I've Forgotten
This behavior has been since the beginning. If you have:
1
01
1
01
If you sort this, you will get all the "01" listed first. This is because a normal sort uses ASCII values, and "0" precedes "1". But if you sort numeric, well, you know what happens.
Craig
1
01
1
01
If you sort this, you will get all the "01" listed first. This is because a normal sort uses ASCII values, and "0" precedes "1". But if you sort numeric, well, you know what happens.
Craig