cancel
Showing results for 
Search instead for 
Did you mean: 

UDF to check alphanumeric or int

former_member309357
Participant
0 Kudos

Hello Gurus,

    I am using PI 7.0 version and had a new requirement as below:

"If the input value contains a pure integer (124536) then the same value to be passed, else (1.25, ad3ed, f$f45) 0 should be passed."

    Please provide desired UDF for the same. Awaiting for your inputs..

Thanks

Ravi

Accepted Solutions (0)

Answers (3)

Answers (3)

pvishnuvardan_reddy
Active Contributor
0 Kudos

Hi Ravi,

Please find below the udf for your requirement for validating the input for integer:

String main ="0123456789";

String res = inp;

int  tmp;

for(int i=0;i<inp.length();i++)

{

   tmp = main.indexOf(inp.substring(i,i+1));

   if(tmp == -1)

   {

      res = "0";

      break;

   }

}

return res;

Regards

Vishnu

iaki_vila
Active Contributor
0 Kudos
iaki_vila
Active Contributor
0 Kudos

Hi Ravi,

Check this thread Check if a Value is Numeric | SCN


Regards.

former_member309357
Participant
0 Kudos

Hi Vila,

    I have checked this, but this is not working for long range values and float values.

Thanks

Ravi