-1

I have taken two string native = "+8801723519932" , and local = "01723519932" , how can I compare two strings to get +88 in a variable "change" from native. without using substring.

sTg
  • 4,313
  • 16
  • 68
  • 115
Barun Kumar
  • 209
  • 1
  • 2
  • 18

2 Answers2

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");
}
Tushar Patil
  • 326
  • 4
  • 22
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);
    }
      }

   }
Shekhar
  • 812
  • 1
  • 8
  • 18