• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 176
  • Last Modified:

Convert some characters to uppercase.

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.
  • 2
1 Solution
MerijnBSr. Software EngineerCommented:
function RickJsUpperCase(St: string): string;
 const Delimiters: set of char = ['_', '/', ' '];
 var i: integer;
  result := St;

  for i := 1 to Length(result) - 1 do
   if result[i] in Delimiters then
    result[i + 1] := UpCase(result[i + 1]);
MerijnBSr. Software EngineerCommented:
var st: string;
 st := RickJsUpperCase('This/is_my/test string.');
 form1.caption := st; // st is now 'This/Is_My/Test String.'
RickJAuthor Commented:
Cool, thanks MerijnB
Works for me.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now