|
Well all the suggestions up to this point seem to missing your request that
"The first letter must
be/stay Upper case." Here is what we use on our name fields. Your mileage may
vary.
-- Scott Johnson
*
* Capitalize First Letter of each Word
D $FirstCap PR 35A
D FC#Text 35A CONST
*
*
*===============================================================*
/TITLE Capitalize First Letter of each Word
*===============================================================*
*
P $FirstCap B EXPORT
*
D $FirstCap PI 35A
D FC#Text 35A CONST
*
D Lo C CONST('abcdefghijklmnopqrstuvwxyz')
D Up C CONST('ABCDEFGHIJKLMNOPQRSTUVWXYZ')
*
D Wrk#Text S 35A
D Wrk#Char S 1A
D Idx S 3P 0
*
* Capitalize the first character
C Eval Wrk#Text = %TRIM(FC#Text)
C Up:Lo XLate Wrk#Text Wrk#Text
C Eval Wrk#Char = %SUBST(Wrk#Text:1:1)
C Lo:Up XLate Wrk#Char Wrk#Char
C Eval %SUBST(Wrk#Text:1:1) = Wrk#Char
*
* Capitalize any character following a space, dash, apostrphe, or period
C 2 Do 34 Idx
*
C If %SUBST(Wrk#Text:Idx:1) = ' ' OR
C %SUBST(Wrk#Text:Idx:1) = '-' OR
C %SUBST(Wrk#Text:Idx:1) = '''' OR
C %SUBST(Wrk#Text:Idx:1) = '/' OR
C %SUBST(Wrk#Text:Idx:1) = '.'
C Eval Wrk#Char = %SUBST(Wrk#Text:Idx+1:1)
C Lo:Up XLate Wrk#Char Wrk#Char
C Eval %SUBST(Wrk#Text:Idx+1:1) = Wrk#Char
C EndIf
*
C EndDo
*
C RETURN Wrk#Text
*
P $FirstCap E
> -----Original Message-----
> From: rpg400-l-bounces@xxxxxxxxxxxx
> [mailto:rpg400-l-bounces@xxxxxxxxxxxx]On Behalf Of Willie J. Moore
> Sent: Thursday, August 14, 2003 4:28 PM
> To: rpg400-l@xxxxxxxxxxxx
> Subject: Convert upper case to lower case
>
>
> I need a program or utility that will convert a name field
> from all UPPER case to lower case. The first letter must
> be/stay Upper case. Is there a program or API that might do this?
> Any help would be greatly appreciated.
> William Moore
> wjmoore@xxxxxxxxxxxxxxx
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2025 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.