
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
How to capitalize the first letter of every word in a String?
I have a column that contains the address in uppercase.In tMap I wanted to write a code that keep the first character of each word uppercase and lowercase the remaining letters of each word in a string.
For example:
Source column: LANE DRIVE 123
Expected output column: Lane Drive 123
Thanks,
Dua
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can use Talend Routine to convert any String into title case.
Here when we find a word separator we capitalize the next character. After that, we change the rest of the characters to lower case until we reach the next word separator.
call the routine in tMap
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi Dua,
please google "java capitalize string" and you will find some solutions for capitalizing strings. In Talend Studio, go to "Code > Routines" in the Repository view to create a routine and write a method that solves your requirement. You can then call your routine (method) for your input strings in a tMap component, for example.
Best regards,
Thomas

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi,
You can use Talend Routine to convert any String into title case.
Here when we find a word separator we capitalize the next character. After that, we change the rest of the characters to lower case until we reach the next word separator.
call the routine in tMap
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Thank You Hesinberg
The solution provided by you is working fine.
I observed that the routine I have created is not showing in tmap Expression builder Under Categories - User define,So i called the routine like this: "routines.Camel_Case.convertToTitleCase(column name)"
