Skip to main content
Announcements
SYSTEM MAINTENANCE: Thurs., Sept. 19, 1 AM ET, Platform will be unavailable for approx. 60 minutes.
cancel
Showing results for 
Search instead for 
Did you mean: 
Anonymous
Not applicable

How to capitalize the first letter of every word in a String?

Hi,

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
Labels (2)
1 Solution

Accepted Solutions
Anonymous
Not applicable
Author

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.

0683p000009M6LB.png

 

 

 

 

 

 

 

 

 

 

 

call the routine in tMap

 

0683p000009M6NQ.png0683p000009M6NV.png


Thanks



 

View solution in original post

3 Replies
ThWabi
Creator II
Creator II

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

 

Anonymous
Not applicable
Author

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.

0683p000009M6LB.png

 

 

 

 

 

 

 

 

 

 

 

call the routine in tMap

 

0683p000009M6NQ.png0683p000009M6NV.png


Thanks



 

Anonymous
Not applicable
Author

Thank You Hesinberg 0683p000009MACn.png

 

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)"