camel case of letters

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.

Highlighted
Eight 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;
}

What’s New for Talend Spring ’19

Join us live for a sneak peek!

Sign up now

Definitive Guide to Data Quality

Create systems and workflow to manage clean data ingestion and data transformation.

Download

Tutorial

Introduction to Talend Open Studio for Data Integration.

Watch

Downloads and Trials

Test drive Talend's enterprise products.

Downloads