cancel
Showing results for 
Search instead for 
Did you mean: 

Extracting Numeric values From String

Former Member
0 Kudos

Hi Experts,

I need to extract the Numeric values from a string?

I think that can be done using UDF? Can i use substring for the same?

Ex: NZD 488775544

Please suggest.

Thanks,

Sushama

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Please check the code:

int len = str.length();

char test = ' ';

for(int counter = 0; counter < len; counter++)

{

test = str.charAt(counter);

if(Character.isDigit(test))

{

return str;

}

}

Former Member
0 Kudos

Hi Sushma,

Small modification in the code..

int len = str.length();

char test = ' ';

int index =0;

for(int counter = 0; counter < len; counter++)

{

test = str.charAt(counter);

if(Character.isDigit(test))

{

index = counter;

counter = len; // to exit the loop...

}

}

return str.substring(index);

Babu

Former Member
0 Kudos

Hi Babu,

Thanks for the help.

Its working now

Regards,

Sushama

Answers (0)