Jump to content
Julian Carr

Upper Case String to Title Caps

Recommended Posts

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

Share this post


Link to post

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

  • Like 1

Share this post


Link to post

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.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


 

7150 Riverwood Drive, Columbia, Maryland 21046, USA   |   Contact Us:   410-290-5114

 

© 2018 Vectorworks, Inc. All Rights Reserved. Vectorworks, Inc. is part of the Nemetschek Group.

×
×
  • Create New...