Change to Title case

General questions about using TextPad

Moderators: AmigoJack, bbadmin, helios, Bob Hansen, MudGuard

Post Reply
prashob12
Posts: 18
Joined: Thu Oct 25, 2007 1:31 am
Location: India

Change to Title case

Post by prashob12 »

Hi All,

I have certain attribute values, see the following example:

bez="vergabekammer baden wurttemberg"

Here i want to change the attribute values to Title case.
I can change the above to upper & smaller case using regex like:

Find: "([^"]+)"
Replace: \U\1 or \L\1

But how should i change to Title case, done tell me about macros as there are many files....

Thanks in advance
Prashob
gan

Post by gan »

I'm not sure if i know exactly what you mean by title case, but i assume you want all the words inbetween the " to have the first letter in uppercase and the rest in lower case. Also since you only provided one line of example i assume the rest of the lines is pretty much the same.

You could try this one that works for your current example. If it doesn't work for other lines or change some lines that should not be changed then please provide some more lines as example where you include the lines where it's not working as expected.

Search for:

Code: Select all

("[a-zA-Z])([a-zA-Z]+)|( [a-zA-Z])([a-zA-Z]+)
and replace with:

Code: Select all

\U\1\L\2
prashob12
Posts: 18
Joined: Thu Oct 25, 2007 1:31 am
Location: India

Post by prashob12 »

I want it to be in Title Case for eg:

Input:

bez="rechtsprechung zum baugenehmigungsverfahren"

bez="einwendungen des nachbarn"

Output should look like this:

bez="Rechtsprechung Zum Baugenehmigungsverfahren"

bez="Einwendungen Des Nachbarn"

I want to change the "small case" to "Title case", i think i am clear this time......
gan

Post by gan »

The example i gave you is supposed to do exactly what you want and your further explanation make no doubt what you mean by title case. Did you try a search and replace using the example provided and what is the result?
webwiz
Posts: 6
Joined: Thu Jul 27, 2006 7:39 pm
Location: Oakland, California
Contact:

Post by webwiz »

1. Highlight the text

2. Press Ctrl-Shift-U

... or from the menu: Edit > Change case > Capitalize
Cordially, David
--
"Eschew obfuscation"
gan

Post by gan »

webwiz wrote:1. Highlight the text

2. Press Ctrl-Shift-U

... or from the menu: Edit > Change case > Capitalize
That will work if ok to capitalize ALL words. As described by prashob12 it seems like the goal is to capitalize the words between the " only. Highlighting could be a pain since there is a lot of files according to prashob12.
Post Reply