1.三个参数分别是:字符串,字符串头,字符串尾
public static String getcontent(String s,String head,String end)
{
int index1=s.indexOf(head);
int index2=index1+head.length();
if(index1>0)
{
index2=s.indexOf(end,index2);
if(index2>0)
{
return s.substring(index1+head.length(),index2);
}
}
return "";
}
本文介绍了一个Java方法,用于从给定的字符串中获取指定字符串头后面到指定字符串尾之前的部分。方法通过indexOf查找头和尾的位置,并返回两位置间的子串。
493

被折叠的 条评论
为什么被折叠?



