on 10-19-2015 10:40 AM
Hi ,
I need to split the phone number string into country code and phone number
Source Target
+44|9742744480 = first field 44 second field = 9742744480
I tried to use sub string function it will get fail when +1|9742744480 or +142|9742744480 will come .
please suggest.
Regards,
you have to use split.
you can try below snippet to get the data in udf.
String[] output = new String[3];
output = input.split("[+|]");
output[1] and output[2] will have 44 and 9742744480 respectively.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Vishnu,
The country code in general can differ from 1 to 4 digits, so i suggest you to refer table T005K table in SAP for these details and apply some look up table or rfc call you can design with your feasibility.
Hope you have country in the payload to proceed in determining this details.
Cheers
Harsha
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hi Muni,
If I need Number with Multiple occurrence do I need to change the execution type and code.
String[] output =new String[3];
output= var1.split("[+|]");
return output[1];
String[] output =new String[3];
output= var1.split("[+|]");
return output[2];
Regards,
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Hello Vishnu ,
1. How may different company codes you might be receiving?
Is that fixed? Based upon that you have to do mapping like IF-then(Sub String) or you can use UDF also.
But first you should be aware how many different kinds of country codes you will be receiving.
2. Another approach will be to tell your source system to send a constant digit county code like 3 digtis always for you to use Sub string.
For e.g. :
+142 = +142
+44 = +044
+1 = +001
Thanks.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
User | Count |
---|---|
89 | |
10 | |
9 | |
9 | |
9 | |
6 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.