Julian Carr Posted July 7, 2020 Share Posted July 7, 2020 Anyone have a lazy script that will convert an upper case string to title caps or even just lower case? Just trying to avoid reinventing the wheel. TIA, Julian Quote Link to comment
MullinRJ Posted July 7, 2020 Share Posted July 7, 2020 Hi Julian, Here's one for lower case. PROCEDURE TEST; CONST CR = chr(13); VAR S :String; function LowerCase(S :String) :String; { Convert string S to lower case. } Var Ch :Char; I, StrLen, ChVal :Integer; T :String; Begin T := ''; StrLen := len(S); for I := 1 to StrLen do begin Ch := copy(S, I, 1); ChVal := ord(Ch); if (ChVal > 64) & (ChVal < 91) then T := concat(T, chr(ChVal+32)) else T := concat(T, Ch); end; { for } LowerCase := T; End; { LowerCase } BEGIN S := '0123456789 !@#$%^&*()_+ ABCDEFGHIJKLMNOPQRSTUVWXYZ abcdefghijklmnopqrstuvwxyz'; message(S, CR, LowerCase(S)); END; Run(TEST); Raymond 1 Quote Link to comment
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.