Skip to Content
0
Former Member
Dec 11, 2007 at 11:00 AM

Little UDF problem concerning substring

19 Views

Hi, i need to do the following in UDF:

read a string ("00002000"), delete the first upcoming "0" and give it back

(the advance action should be, that the last three "0" should be taken and add a "." before it. Result will be "2.000")

the simple requirement i tried with this code:

int position = 0;

String target = "0";

String newString;

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

int temp = LFIMG.charAt(i);

if (LFIMG.valueOf(i) != target) {

position = i;

break;

}

}

newString = LFIMG.substring(position);

but something is wrong here!

can u help? br