我已经使用了两个字符串native =" +8801723519932
" ,和本地=" 01723519932
" ,
如何在strings
"更改"中将两个+88
与variable
进行比较?来自本地人。不使用substring
。
答案 0 :(得分:0)
native = "+8801723519932"
local = "01723519932"
change = ?
**Compare both strings:-**
if(native.equals(local)){
System.out.println("Match");
}else{
System.out.println("Not Match");
}
**Get +88 from given string without using subString.**
if(native.indexOf("+88")>=0){
System.out.println("+88");
}
答案 1 :(得分:0)
public class a {
public static void main(String[] args) {
// TODO Auto-generated method stub
String nativea="+8801723519932";
String local = "01723519932";
String str[]=nativea.split(local);
for (int i = 0; i < str.length; i++) {
String string = str[i];
System.out.println(string);
}
}
}