cancel
Showing results for 
Search instead for 
Did you mean: 

Change only first letter to uppercase

Former Member
0 Kudos

Hello,

Have a way in graphical mapping to change only the first letter to uppercase?

Elad

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Swarup was right.

But when value is used as cache parameter arrays shud nt be used.

This works perfectly.

public String uppercase(String a,Container container)

{

return((a.substring(0,1)).toUpperCase()+ a.substring(1,a.length()));

}

Answers (7)

Answers (7)

Former Member
0 Kudos

Creation of simple UDF is the option.

By Mapping you can take the first char, also make it in upperCase. but how you will concatinate the rest of the filed?

example "sap PI"

By standard function: u can make s as upper "S". but how you will take rest date "ap PI". SO better to go for UDF with exceptional handling.

Thanks

Farooq

Former Member
0 Kudos

Do it with standard dunctions.

Here is the solution:

https://weblogs.sdn.sap.com/weblogs/images/251803663/UDF.JPG

But also try to take care of Exception handling. If string is empty or has only 1 char. then it will fail.

thanks,

farooq.

Edited by: Farooq Farooqui on Jul 30, 2008 12:36 PM

Former Member
0 Kudos

Farooq,

Your recommendation is not possible because in the second substring I didn't know how length is the string.

Elad

Former Member
0 Kudos

hi

set second Substring :starting position=1 and numberof chareters =0

kasturika

Former Member
0 Kudos

hi,

Please do the following mapping. hope this will help you.

input-->SUBSTRING1>uppercase-->Firstinput to concate function

CONCATE----


>output

input-->SUBSTRING2--->second input to concatefunction

Set Substring1: starting position=0 and numberof chareters =1

set Substring2 :starting position=1 and numberof chareters =0

regards

Kasturika

former_member193376
Active Contributor
0 Kudos

HI

pass your string as input that you want to change your first char to uppercase.

assuming your input is String var;

int len = var.length();

String str1="",str2="";

str1 = var.substring(0,1);

str2 = var.substring(1,len);

str1 = str1.toUppercase();

str2 = str1 + str2;

return str2;

hope this helps

Thanks

Saiyog

Former Member
0 Kudos

Hi,

You need to create UDF with cache parameter as Value and just single line statement

return((a[0].substring(0,1)).toUpperCase()+ a[0].substring(1,a[0].length()));

Thanks

Swarup

santhosh_kumarv
Active Contributor
0 Kudos

Hi,

If your source field is always having fixed length then u can use the combination of subString, toUpperCase and concat text functions. If not you have to use the UDF.

Thanks

SaNv...

sunilchandra007
Active Contributor
0 Kudos

Hi ,

U can use the functions subString, toUpperCase and concat of Text category in ur case.

Get the first character of the string with substring function, covert it to uppercase with toUpperCase an d concat it with remaining string.

regards ,

Chandra

Former Member
0 Kudos

You need to use UDF

In UDF, take out first character in original string

use firstCharString.toUpperCase()

then concatenate it with rest of the string and

return newString