cancel
Showing results for 
Search instead for 
Did you mean: 

Mapping doubt

Former Member
0 Kudos


Hi Experts,

can you help with UDF code for below logic.

-->Need to check whether input field is numeric or not, if so need to check whether length of the field is 9 or not, if so need to append '-' between 5th and 6th digit.

Thanks for your help in advance.

Accepted Solutions (1)

Accepted Solutions (1)

markangelo_dihiansan
Active Contributor
0 Kudos

HI Mohan,

Here you go:

UDF Type: single values

arguments: inp (String)


if(inp.matches("[-+]?\\d*\\.?\\d+")){

  if(inp.length()==9){

       return inp.substring(0,5)+"-"+inp.substring(5);

  }

  else{

       return inp;

  }

}

else{

     return "not numeric";

}

Regards,

Mark

Former Member
0 Kudos

Thanks Mark. It worked.

Answers (0)