Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Convert some characters to uppercase.

Posted on 2006-11-30
3
Medium Priority
?
175 Views
Last Modified: 2010-04-05
Hello,
I would like some suggestions on the simplest function/procedure to do the following.
I have a string as follows;

This/is_my/test string.

I need it to be changed to this
This/Is_My/Test String.

Essentially I need to search for all occurences of '/' '_' and spaces, and uppercase the character following.
Hope this makes sense.
0
Comment
Question by:RickJ
  • 2
3 Comments
 
LVL 19

Accepted Solution

by:
MerijnB earned 2000 total points
ID: 18043774
function RickJsUpperCase(St: string): string;
 const Delimiters: set of char = ['_', '/', ' '];
 var i: integer;
 begin
  result := St;

  for i := 1 to Length(result) - 1 do
   if result[i] in Delimiters then
    result[i + 1] := UpCase(result[i + 1]);
 end;
0
 
LVL 19

Expert Comment

by:MerijnB
ID: 18043783
usage:
var st: string;
begin
 st := RickJsUpperCase('This/is_my/test string.');
 form1.caption := st; // st is now 'This/Is_My/Test String.'
end;
0
 
LVL 8

Author Comment

by:RickJ
ID: 18043868
Cool, thanks MerijnB
Works for me.
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In this tutorial I will show you how to use the Windows Speech API in Delphi. I will only cover basic functions such as text to speech and controlling the speed of the speech. SAPI Installation First you need to install the SAPI type library, th…
Hello everybody This Article will show you how to validate number with TEdit control, What's the TEdit control? TEdit is a standard Windows edit control on a form, it allows to user to write, read and copy/paste single line of text. Usua…
Want to learn how to record your desktop screen without having to use an outside camera. Click on this video and learn how to use the cool google extension called "Screencastify"! Step 1: Open a new google tab Step 2: Go to the left hand upper corn…
In response to a need for security and privacy, and to continue fostering an environment members can turn to for support, solutions, and education, Experts Exchange has created anonymous question capabilities. This new feature is available to our Pr…
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question