I am getting a field from SAP with 18digits (Alphanumeric). I want to send 8 characters only to a File with the help of XI. So my requirement is if it is numeric then I want the last 8 digits only else if it is character then the first 8 characters only.
I know that with the help of substring function we can take the first or last 8 characters. But how to check the condition whether it is numeric or character? If we want to write a function can you please let me know the code to resolve my issue?
You do not need import any thing, it just should work as is.
you may need to change
int i = Integer.parseInt(a.trim());
double i = Double.parseDouble(a.trim());
just in case your nmber is too large and out of range.
But anyway, it should work as is.