camel case of letters

Highlighted
Five Stars

camel case of letters

Hi,

 

I want to convert the first letter of the name to upper case and the rest of the letters to down case. even after the space between the letters also, how to do using tmap.

Moderator

Re: camel case of letters

Hello,

Could you please elaborate your case with an example with input and expected output values?

Best regards

Sabrina

--
Don't forget to give kudos when a reply is helpful and click Accept the solution when you think you're good with it.
Five Stars

Re: camel case of letters

Hi  Xdshi,

 

Thanks for your quickly reply. my  input & output as below.

input : tom crew

output: Tom crew

I got the result by calling routine.

Nine Stars

Re: camel case of letters

hi karthik,
have you created a routine..
can you pls share.. what approach you have followed
Five Stars

Re: camel case of letters

Hi Ankit,

 

use the below routine.

 

 

public static String titleCase(String text)
{
String result = "";

if(isFieldBlank(text))

return "";
String input = text.trim().toLowerCase();

char firstChar = input.charAt(0);
result = result + Character.toUpperCase(firstChar);
for (int i = 1; i < input.length(); i++) {
char currentChar = input.charAt(i);


result = result + currentChar;

return result;
}

private static boolean isFieldBlank(String text) {
// TODO Auto-generated method stub
return false;
}

2019 GARNER MAGIC QUADRANT FOR DATA INTEGRATION TOOL

Talend named a Leader.

Get your copy

OPEN STUDIO FOR DATA INTEGRATION

Kickstart your first data integration and ETL projects.

Download now

What’s New for Talend Summer ’19

Watch the recorded webinar!

Watch Now

Best Practices for Using Context Variables with Talend – Part 4

Pick up some tips and tricks with Context Variables

Blog

How Media Organizations Achieved Success with Data Integration

Learn how media organizations have achieved success with Data Integration

Read

Downloads and Trials

Test drive Talend's enterprise products.

Downloads