on 11-21-2008 2:41 PM
We are using Graphical/Message mapping here.....
Problem is: I need to truncate the LAST 10 digits of a string. The source can vary in length.
e.g.
Source: 3245678567945
Target would look like: 5678567945
Analysis:
We looked all the functions available in message mapping, but nothing seems to be in this use. I thought of using the "Substring" function available in Message Mapping, but it is going to give me first 10 digits (Left to Right).
Any expert can help please?
Hi,
you need an UDF for this:
> if (a.length() > 9) {
> a = a.substring(a.length() - 10, a.length());
> }
> return a;
Regards
Patrick
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
write simple udf
function truncateLast( String s )
{
if ( s != null && s.length() >= 10 )
{
s = s.substring ( s.length() - 10, s.length() );
}
return s;
}
i though to truncate last 10.. so changed the params for substring.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
90 | |
10 | |
10 | |
10 | |
7 | |
7 | |
6 | |
5 | |
4 | |
3 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.