## Re: [Clip] Changing numbers to ordinal

Expand Messages
• Hi Rick: The following clip snippet should give you most of what you want: H= Add Ordinal Clip ; the following is one long line. ^!SetArray
Message 1 of 10 , Mar 23, 2006
• 0 Attachment
Hi Rick:

The following clip snippet should give you most of what you want:

; the following is one long line.
^!SetArray
%Ordinal%="1st";"2nd";"3rd";"4th";"5th";"6th";"7th";"8th";"9th";"10th";"11t
h";"12th";"13th";"14th";"15th";"16th";"17th";"18th";"19th";"20th";"21st";"2
2nd";"23rd";"24th";"25th";"26th";"27th";"28th";"29th";"30th";"31st"
; End of long line.
^!Set %day%=^\$GetSelection\$
^!Info ^%Ordinal^%day%%

On Wed, 22 Mar 2006 20:35:27 -0000, rickah wrote:
> I'd like to change add ordinal suffixes to certain numbers in text
> relating to calendar dates. I can't believe there is not a clip for this
> all ready, but I can't find it.
>
> i.e.;
> 1, 11, 21 becomes 1st, 11th, 21st
> 2, 12, 22 becomes 2nd, 12th, 22nd
> 3, 13, 23 becomes 3rd, 13th, 23rd
> All other dates become nth
• Thank you very much Mr. Raine. The clip works perfectly for changing a selected number from cardinal to ordinal; i.e.: 23 to 23rd . One does have to be
Message 2 of 10 , Mar 23, 2006
• 0 Attachment
Thank you very much Mr. Raine. The clip works perfectly for
changing
a selected number from cardinal to ordinal; i.e.: "23" to "23rd".

One does have to be careful to remove extraneous spaces and line

Thanks again.
Rick.

--- In ntb-clips@yahoogroups.com, "Charles M. Raine" <rainec@...>
wrote:
>
> Hi Rick:
>
> The following clip snippet should give you most of what you want:
>
> ^!SetArray %Ordinal%"1st"; . . . ;"31st"

> ^!Set %day%=^\$GetSelection\$
> ^!Info ^%Ordinal^%day%%

> > 1, 11, 21 becomes 1st, 11th, 21st
> > 2, 12, 22 becomes 2nd, 12th, 22nd
> > 3, 13, 23 becomes 3rd, 13th, 23rd
> > All other dates become nth
• P.S. I changed ^!Info ^%... to ^!InsertHTML ^%... so that it automatically updates the number. I hope this is the correct process. It seeems to work.
Message 3 of 10 , Mar 23, 2006
• 0 Attachment
P.S. I changed "^!Info ^%..." to "^!InsertHTML ^%..." so that it
automatically updates the number. I hope this is the correct process.
It seeems to work.

Yours,
Rick
• ... The previous clip, H= Add Ordinal Clip , works well to thirty-one but those long can be trouble and without mods is limited to 31. I thought this might be
Message 4 of 10 , Mar 24, 2006
• 0 Attachment
rickah wrote:
> P.S. I changed "^!Info ^%..." to "^!InsertHTML ^%..." so that it
> automatically updates the number. I hope this is the correct process.
> It seeems to work.
>
> Yours,
> Rick

The previous clip, H="Add Ordinal Clip", works well to thirty-one but
those long can be trouble and without mods is limited to 31.

I thought this might be a useful clip and I went another way. This clip
should add the correct suffix to any number, I've tested combinations to
over a thousand. This clip allows you to quickly add an ordinal suffix
to all numbers.

<>·······Start Clip·······<>
H="ORDINALS EVERYWHERE"
;_ Modified-Updated~Created_20060324
;_ hrs ø hsavage·pobox·com_06:05:43p
; 1st 2nd 3rd 4th 11th
; array of ordinal suffixes
^!SetArray %sfx%=st;nd;rd;th
^!Set %num%=^\$GetSelection\$
;
^!If ^\$StrCopyRight("^\$GetSelection\$";2)\$ = 11 ^!InsertText ^%num%^%sfx4%
^!If ^\$StrCopyRight("^\$GetSelection\$";2)\$ = 12 ^!InsertText ^%num%^%sfx4%
^!If ^\$StrCopyRight("^\$GetSelection\$";2)\$ = 13 ^!InsertText ^%num%^%sfx4%
^!If ^\$StrCopyRight("^\$GetSelection\$";1)\$ => 4 ^!InsertText ^%num%^%sfx4%
^!If ^\$StrCopyRight("^\$GetSelection\$";1)\$ = 0 ^!InsertText ^%num%^%sfx4%
^!If ^\$StrCopyRight("^\$GetSelection\$";1)\$ = 1 ^!InsertText ^%num%^%sfx1%
^!If ^\$StrCopyRight("^\$GetSelection\$";1)\$ = 2 ^!InsertText ^%num%^%sfx2%
^!If ^\$StrCopyRight("^\$GetSelection\$";1)\$ = 3 ^!InsertText ^%num%^%sfx3%
<>········End Clip········<>

Each of the longer lines ends with ^!InsertText ^%num%^%sfx(1-4)%

ºvº
06.03.24_17.37
hrs ø hsavage@...
• typo this line? ^!If ^\$StrCopyRight( ^\$GetSelection\$ ;1)\$ = 4 ^!InsertText ^%num%^%sfx4%
Message 5 of 10 , Mar 24, 2006
• 0 Attachment
typo this line?
^!If ^\$StrCopyRight("^\$GetSelection\$";1)\$ => 4 ^!InsertText ^%num%^%sfx4%
• ... Don, What about this line indicates a typo, if referencing, greater than, it is there to insure digits 4-9 are handled. I know NoteTab displays it in
Message 6 of 10 , Mar 24, 2006
• 0 Attachment
Don - htmlfixit.com wrote:
> typo this line?
> ^!If ^\$StrCopyRight("^\$GetSelection\$";1)\$ => 4 ^!InsertText ^%num%^%sfx4%

Don,

it is there to insure digits 4-9 are handled.

I know NoteTab displays it in help this way, >= returns True if left
value is greater or equal to right value, but reversing symbols works also.

ºvº
06.03.24_17.57
hrs ø hsavage@...
• ... Yep didn t realize it worked either way. Excellent job.
Message 7 of 10 , Mar 25, 2006
• 0 Attachment
hsavage wrote:
> Don - htmlfixit.com wrote:
> > typo this line?
> > ^!If ^\$StrCopyRight("^\$GetSelection\$";1)\$ => 4 ^!InsertText ^%num%^%sfx4%
>
> Don,
>
> it is there to insure digits 4-9 are handled.
>
> I know NoteTab displays it in help this way, >= returns True if left
> value is greater or equal to right value, but reversing symbols works also.

Yep didn't realize it worked either way. Excellent job.
• Mr. Savage, Yes, it does work just as you say. Thank you very much. I have added it to my library. Yours, Rick ... clip ... combinations to ... suffix ...
Message 8 of 10 , Mar 25, 2006
• 0 Attachment
Mr. Savage,
Yes, it does work just as you say. Thank you very much. I have

Yours,
Rick

--- In ntb-clips@yahoogroups.com, hsavage <hsavage@...> wrote:

> I thought this might be a useful clip and I went another way. This
clip
> should add the correct suffix to any number, I've tested
combinations to
> over a thousand. This clip allows you to quickly add an ordinal
suffix
> to all numbers.
>
> <>·······Start Clip·······<>
> H="ORDINALS EVERYWHERE"
<snip>
> <>········End Clip········<>
>
> Each of the longer lines ends with ^!InsertText ^%num%^%sfx(1-4)%
Your message has been successfully submitted and would be delivered to recipients shortly.