Welcome To The Home Of The Visual FoxPro Experts  
home. signup. forum. archives. search. articles. downloads. faq. members. files. rss.
 From: Anders Altberg
  Where is Anders Altberg?
 Uppsala
 Sweden
 Anders Altberg
 To: Mike Yearwood
  Where is Mike Yearwood?
 Toronto
 Canada
 Mike Yearwood
Subject: RE: REPLACE 1 WITH FIRST,2 WITH SECOND
Thread ID: 183457 Message ID: 183796 # Views: 1 # Ratings: 0
Version: Visual FoxPro 6 Category: Reports and Printers
Date: Tuesday, July 15, 2008 1:59:38 PM         
   



> > The report writer to be able to transform numbers to Words as follows
> >
> >
> > PL_NO WORD
> > 1 FIRST
> > 2 SECOND
> > 3 THIRD
> > 4 FOURTH
> > 5 FIFTH
> > ETC
> >
> > I'm building a report, and I'd want the report writer for the occurence of the field 'PL_NO' to write
> > its equivalent word instead in the report.
> >
> > Pls assist
> >
> > Thanks
>
> http://fox.wikis.com/wc.dll?Wiki~DateOrdinal~VFP
>
> Mike Yearwood
>
>

A bit more generalized I believe this would do too:

PROCEDURE GetOrdinal (tiNumber)
RETURN ;
TRANSFORM(tiNumber)+;
ICASE(;
INLIST(tiNumber,11,12,13),'th', ;
tiNumber%10=1,'st',;
tiNumber%10=2,'nd',;
tiNumber%10=3,'rd',;
'th')


-Anders

ENTIRE THREAD

REPLACE 1 WITH FIRST,2 WITH SECOND Posted by Leonard Trevor @ 7/14/2008 5:21:30 AM
RE: REPLACE 1 WITH FIRST,2 WITH SECOND Posted by Anders Altberg @ 7/14/2008 7:09:35 AM
RE: REPLACE 1 WITH FIRST,2 WITH SECOND Posted by Andy Kramek @ 7/14/2008 12:18:52 PM
RE: REPLACE 1 WITH FIRST,2 WITH SECOND Posted by Mike Yearwood @ 7/14/2008 9:51:25 PM
RE: REPLACE 1 WITH FIRST,2 WITH SECOND Posted by Anders Altberg @ 7/15/2008 1:59:38 PM
RE: REPLACE 1 WITH FIRST,2 WITH SECOND Posted by Mike Yearwood @ 7/15/2008 4:48:31 PM
RE: REPLACE 1 WITH FIRST,2 WITH SECOND Posted by Anders Altberg @ 7/15/2008 4:58:10 PM
RE: REPLACE 1 WITH FIRST,2 WITH SECOND Posted by Mike Yearwood @ 7/15/2008 5:32:33 PM
RE: REPLACE 1 WITH FIRST,2 WITH SECOND Posted by Anders Altberg @ 7/15/2008 6:35:52 PM
RE: REPLACE 1 WITH FIRST,2 WITH SECOND Posted by Mike Yearwood @ 7/15/2008 8:24:26 PM