cancel
Showing results for 
Search instead for 
Did you mean: 

adding hyphens(-) between the characters

former_member232455
Participant
0 Kudos

Hi Friends,

I have one requirement,from sender we are receiving the 16 characters value and target is expecting 23 characters value including hyphen between every 2 characters.

For example:

source value: abcdefghijklmnop

Target expected value: ab-cd-ef-gh-ij-kl-mn-op

could you please suggest how can i achieve this with simple UDF?

I tried through standard functions, it's working fine.. but i need UDF for the same

Regards,

Janardhan

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

Hi Janardhan,

You can use this UDF

Result

Regards,

Mark

Answers (3)

Answers (3)

former_member190293
Active Contributor
0 Kudos

Hi Janardhan!

You can use UDF which I posted in this thread

http://scn.sap.com/thread/3913013

with small changes.

Regards, Evgeniy.

former_member186851
Active Contributor
0 Kudos

Guess its possible without UDF if the length is fixed as 16.

former_member232455
Participant
0 Kudos

yes Raghu, it is possible with out UDF also.But with standard mapping it's look like very big mapping. so i just want to know is there any UDF for the same.

Regards,

Janardhan

bhagya_nayanala
Explorer
0 Kudos

Hi

Code goes something like this ...you have to modify it with parameter variable you are passing

Strina a="abcdefghijklmnop";

String s=new String();

String temp=new String();

int j=0;

for(int I=2;I<=a.length();I+=2)

{

if(I!=a.length())

{

s=a.substring(j,I)+"_";

temp=temp.concat(s);

j=j+2;

}

if(I==a.length())

{

s=a.substring(j,I);

temp=temp.concat(s);

}

}

return temp;

-Bhagya

former_member186851
Active Contributor
0 Kudos

Hello Jana,

You can try with Standard functions with below logic