-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,132
  • 12
  • 65
  • 109
Barun Kumar
  • 199
  • 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
  • 356
  • 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
  • 797
  • 1
  • 7
  • 18