我有一个谷歌游戏商店网址“https://play.google.com/store/apps/details?id=com.apusapps.launcher&hl=en”来自这个网址我必须将“com.example.launcher”存储在一个单独的变量中并比较包名“com.example.launc”如果比较我必须发送一个json请求。我可以这样做吗
答案 0 :(得分:0)
试试这个:
String s = "https://play.google.com/store/apps/details?id=com.apusapps.launcher&hl=en";
String s2 = s.substring(s.indexOf("=")+1, s.indexOf("&"));
Toast.makeText(this,"Milad: "+s2,Toast.LENGTH_LONG).show();
答案 1 :(得分:0)
你可以这样做:
String urlString = url.toString();
String finalString = urlString.substring(urlString.indexOf("=")+1,urlString.lastIndexOf("&"));
if(finalString.equals(getApplicationContext().getPackageName())){
//Your code
}