我有一个来自EditText的字符串,其第一个字符为exportDataAsCsv(params)
如何更改具有特定字符串0
的{{1}}
例如,如果String为“ 0911-111-1111”,则其应为“ + 22911-111-1111”
0
答案 0 :(得分:1)
很容易, 您将获得字符串文本,因此您可以做到
btn_request_sms.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
phone = inputPhone.getText().toString().trim();
if (phone.length() == 13) {
if (phone.startsWith("09")) {
phone = "+22" + phone.substring(1, phone.length());
runVerification(phone);
} else {
Toast.makeText(getApplicationContext(), "Mobile number is wrong", Toast.LENGTH_SHORT).show();
}
} else {
Toast.makeText(getApplicationContext(), "Mobile length is wrong", Toast.LENGTH_SHORT).show();
}
}
});