Skip to Content
author's profile photo Former Member
Former Member

Number Format

Hi,

I have a number of variable length at the source, now i need to just consider only the last five digits of the number to map it to target, could anybody help me with this. the source field length is always greater than 5.Thank you.

Add a comment
10|10000 characters needed characters exceeded

Assigned Tags

Related questions

2 Answers

  • Best Answer
    Posted on Jan 11, 2007 at 05:32 AM

    Hi,

    Write a simple User Defined Function.

    String inputNumber;
    
    Int len= inputNumber.length();
    String output= inputNumber.substr(len-6,len-1);
    return output

    Regards

    Bhavesh

    Add a comment
    10|10000 characters needed characters exceeded

  • author's profile photo Former Member
    Former Member
    Posted on Jan 11, 2007 at 05:33 AM

    Hi,

    You can use a simple UDF to do this. It will work even if its a number.

    The input to the UDFs' will always be string.

    input: a,

    put this code in your UDF,

    return a.substring(a.length()-5,a.length());

    This should work.

    Regards,

    P.Venkat

    Add a comment
    10|10000 characters needed characters exceeded

Before answering

You should only submit an answer when you are proposing a solution to the poster's problem. If you want the poster to clarify the question or provide more information, please leave a comment instead, requesting additional details. When answering, please include specifics, such as step-by-step instructions, context for the solution, and links to useful resources. Also, please make sure that you answer complies with our Rules of Engagement.
You must be Logged in to submit an answer.

Up to 10 attachments (including images) can be used with a maximum of 1.0 MB each and 10.5 MB total.