我有一个来自 EditText 的字符串0作为第一个字符我如何更改0特定字符串"+22"例如,如果字符串是“0911-111-1111”,那么它应该是“+22911-111-1111”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("0")) { // here how to split string } else { Toast.makeText(getApplicationContext(), "Mobile number is wrong", Toast.LENGTH_SHORT).show(); } } else { Toast.makeText(getApplicationContext(), "Mobile length is wrong", Toast.LENGTH_SHORT).show(); } } });
添加回答
举报
0/150
提交
取消