我的网址总是以数字结尾,例如:
  String url = "localhost:8080/myproject/reader/add/1/";
  String anotherurl = "localhost:8080/myproject/actor/take/154/";
我想提取最后两个斜杠("/")之间的数字.
有谁知道我怎么做到这一点?
你可以拆分字符串:
String[] items = url.split("/");
String number = items[items.length-1]; //last item before the last slash
| 归档时间: | 
 | 
| 查看次数: | 1003 次 | 
| 最近记录: |