Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

substring with numbers

Hi XI masters,

Does anyone know how to cut an input so that only the first numbers would be left?

Ex. 100_hello -> 100

98_hello -> 98

1000_computer -> 1000

I tried using substring (0,3) then I realized that the numbers could have different digits. They are not always 3.

Former Member
replied

Hi,

This is only possible via UDF.

UDF type is ContextType,

input argument is input

for(int a=0;a<input.length;a++){

result.addValue(input[a].substring(0,input[a].indexOf("_")));

}

hope this helps,

0 View this answer in context
Not what you were looking for? View more on this topic or Ask a question