cancel
Showing results for 
Search instead for 
Did you mean: 

UDF query

former_member183906
Active Contributor
0 Kudos

HI,

Can u please help me in writing UDF for example below :

input,output and logic is as follows :

INPUT is -

<D>6 x 1 L Milk</D>

OUTPUT

<E>6</E>

Logic -

Character string to the left of " x " if " x " occurs in the first 8 characters of D.

Regards

Accepted Solutions (1)

Accepted Solutions (1)

Muniyappan
Active Contributor
0 Kudos

Hi,

can you try below code.

String s ="6 x 1 L Milk";

        int i;

        s = s.replaceAll(" ","");

        i =s.indexOf("x");

      if(i>=1 && i<=7)

      {

      s=s.substring(i-1,i);

       return s;

      }

if x comes in first like "x1234567" it will not return anything.

Regards,

Muniyappan.

Answers (1)

Answers (1)

praveen_sutra
Active Contributor
0 Kudos

hi ,

PFB the suggestion:

thanks and regards,

Praveen T