解释:endsWith() ——此方法测试字符串是否以指定的后缀 suffix 结束。

 

此方法的定义:public boolean endsWith(String suffix)

 

我这里判断的是路径是否是以“/”为结尾的,不是的话就添加一个“/”

//判断是否为“/”结尾的字符串

private String getPath(String sendpath){

StringBuffer url = new StringBuffer();

url.append(sendpath);

if(!sendpath.endsWith()){

url.append("/");

}

}

 

相关文章:

  • 2022-12-23
  • 2021-09-22
  • 2022-12-23
  • 2021-11-18
  • 2021-11-22
  • 2021-11-29
猜你喜欢
  • 2021-10-15
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-06-11
  • 2021-12-26
  • 2021-05-30
相关资源
相似解决方案