Reputation: 5431
I need to turn +81034873845⇒+8134873845 when making call only. But i can not find any related documents based on it. What should i need to write in Google to search?Or have you any tutorial like this ?
Upvotes: 1
Views: 152
Reputation: 9590
public String getNumber(String number)
{
return number.replace("+810","+81");
}
String number = getNumber("+8109083001700");
Upvotes: 1
Reputation: 29670
You can create your own custom method for such requirement.
public String getPhoneNumber ( String phoneNumber )
{
StringBuffer sb = new StringBuffer();
sb.append( phoneNumber.substring(0, 3) );
sb.append( phoneNumber.substring( 4 ) );
return sb.toString();
}
Upvotes: 1
Reputation: 4400
Use StringBuffer
for this purpose And then Replace the specified character of the String with Null
in this Way:-
String phonenumber = "+8109083001700";
StringBuffer phoneNo = new StringBuffer (phonenumber);
int x = phoneNo.length();
phonenumber=phoneNo.replace((x-1),3, "");
Upvotes: 1