on 02-20-2019 11:36 AM
Hi
I need a udf (Groovy Script)to fetch all the value in string which comes before "%"
for eg if the value is coming "CRN-YB20-DNB-SEPSDK%3Fcomp%3Dmp .. then fetch the value before 1st "%".
so result will be CRM-XB10-DNB-SEPSDK.. (total length of this string is 24 char)
note - % may or may not come in string
Hello,
You could use the tokenizer for this,
import com.sap.it.api.mapping.*;
def String GetBeforeToken(String input, String token){
return input.tokenize(token)[0];
}
So here the token value would be a Constant "%"
And if there is no token in the input, it will return the string as is in the output.
Kind Regards
Sanjali
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
To get all values in a queue we have to use the Output parameter of the mapping function so it would look something like this,
import com.sap.it.api.mapping.*;
def void GetListByToken(String[] input,String[] token, Output output) {
def inputList = input[0].tokenize(token[0]);
if(inputList){
inputList.each{
output.addValue(it);
}
}
}
Regards
Sanjali
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
76 | |
10 | |
9 | |
9 | |
6 | |
5 | |
5 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.