Solved

Convert some characters to uppercase.

Posted on 2006-11-30
3
168 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 500 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

The uses clause is one of those things that just tends to grow and grow. Most of the time this is in the main form, as it's from this form that all others are called. If you have a big application (including many forms), the uses clause in the in…
Introduction Raise your hands if you were as upset with FireMonkey as I was when I discovered that there was no TListview.  I use TListView in almost all of my applications I've written, and I was not going to compromise by resorting to TStringGrid…
With the power of JIRA, there's an unlimited number of ways you can customize it, use it and benefit from it. With that in mind, there's bound to be things that I wasn't able to cover in this course. With this summary we'll look at some places to go…
Hi friends,  in this video  I'll show you how new windows 10 user can learn the using of windows 10. Thank you.

920 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now