cancel
Showing results for 
Search instead for 
Did you mean: 

UDF for Alphanumeric split

Former Member
0 Kudos

Please find the requirement below and provide solution. The alphanumeric value should be separated,multiplied and combined with "-".  Thanks in advance.

example 1:

Input = 2.5XV

Output = 025-XV

example 2:

Input = 3V

Output = 030-V

example 3:

Input = 14.5Z

Output = 145-Z

Accepted Solutions (1)

Accepted Solutions (1)

former_member190293
Active Contributor
0 Kudos

Hi, G GANGADHAR!

Mapping:

Mapping result:

Regards, Evgeniy.

Former Member
0 Kudos

Yes, This is correct output, I achieved the same result but with multiple UDF's,If statements and concatenation.

This looks very simple and less processing. Thank you.

Former Member
0 Kudos

HI Evgeniy,

Your code is working fine for my 3 inputs. Now we got new addition to that. It should by-pass if the value contains only alphabet.

example 4:

Input = ALL

Output = ALL

former_member190293
Active Contributor
0 Kudos

Hi G GANGADHAR!

If your string has only two possible types like [Digits][Alpha] or [Alpha], than just add the check in the beginning of your UDF:

if (Character.isLetter(strInput.charAt(0)))

     return strInput;

Regards, Evgeniy.

Answers (1)

Answers (1)

former_member190293
Active Contributor
0 Kudos

Hi G GANGADHAR!

At first please provide exact algorithm of formatting.

Is your requirement to format numeric part as 3-digit integer with leading zeroes in any case?

Regards, Evgeniy.