Skip to Content
avatar image
Former Member

mapping requirement

Hi All,

my requirement is source field value is 12345_00010.

my expected out put is 00010.

after underscore i need to get the output.

plz send me udf for this requirement.

Thanks,

Aadi

Add comment
10|10000 characters needed characters exceeded

  • Follow
  • Get RSS Feed

4 Answers

  • May 22, 2013 at 06:10 AM

    Hi,

    >>>plz send me udf for this requirement.

    why don't you just put - split java in google and do the UDF yourself ? it's a good exercise 😊

    Regards,

    Michal Krawczyk

    Add comment
    10|10000 characters needed characters exceeded

  • avatar image
    Former Member
    May 22, 2013 at 07:25 AM

    Hi,

    Try the below code in your UDF :

    { int n = var1.indexOf("_");

    String result = var1.substring((n+1));

    return result;

    }

    where var1 takes input from the incoming source field.

    Add comment
    10|10000 characters needed characters exceeded

  • May 22, 2013 at 07:51 AM

    Hi ,,

    try this.

    public String Test(String var1, Container container) throws StreamTransformationException{

    String str = "_";

    int len=var1.length();

    int i =var1.indexOf(str);

    str= var1.substring(i+1,len);

    return str;

    }

    Regards,

    Loordh

    Add comment
    10|10000 characters needed characters exceeded

  • May 22, 2013 at 01:41 PM

    Hi,

    check below java code for splitting.

    http://www.roseindia.net/tutorial/java/core/splitmethod.html

    do the splitting and return the second array string.that would be your final output.

    you can refer below for creating UDF.

    http://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/be05e290-0201-0010-e997-b6e55f9548dd?QuickLink=events&overridelayout=true&5003637520828

    Regards,

    Muniyappan.

    Add comment
    10|10000 characters needed characters exceeded