cancel
Showing results for 
Search instead for 
Did you mean: 

Java Function for Split (UDF)

Former Member
0 Kudos

Hello All,

I need to create a UDF to split the contents of my input values.

InputValue = abcdefghijklmnopqr

Expected Output = cdefghklm

I need the output should be like this cdefghklm. Can you give me the code for this Java function to build.

Thanks,

Jane.

Accepted Solutions (0)

Answers (4)

Answers (4)

former_member181962
Active Contributor
0 Kudos

This code is for splitting at a particular character in this example a "-".

input to the UDF is a string called a.

int ind = a.indexOf("-");

if (ind>=0){

ind++;

return a.substring(ind,a.length());

}

else{

return a;

}

Regards,

Ravi Kanth Talagana

Former Member
0 Kudos

Input1 ---> SubString function of (2,5) ---Concat1 --|


>Concat2 -


> Output

Input1 ---> SubString function of (5,8) ---Concat1 --

Input1 ---> SubString function of (10,18) -


This how the mapping file will be.

Former Member
0 Kudos

Hi jane,

If the length of the inputValue is fixed, then you can use inputvalue.substring() function.

The procedure is simple

first obtain the substring (2,7)

then obtain the substring (10,12)

Then <b>concat </b>these to strings you will obtain your Expected Output.

regards

Ramesh P

former_member214364
Active Contributor
0 Kudos

Hi Jane,

What is the mapping rule.i mean how do you want to split input value? is it based on text or index?