获取如下图响应信息html页面中的
fec7f1e4-30e0-41d1-9417-bb4829be51dc 值

indexOf()其实就是在字符串中查找其子串第一次出现的位置,如果没有找到该子串,则返回-1
四种用法:
1、int indexOf(String str) :返回第一次出现的指定子字符串在此字符串中的索引。
2、int indexOf(String str, int startIndex):从指定的索引处开始,返回第一次出现的指定子字符串在此字符串中的索引。
3、int lastIndexOf(String str) :从结尾向左搜索,返回在此字符串中第一次出现的指定子字符串的索引。
4、int lastIndexOf(String str, int startIndex) :从指定的索引处开始向左搜索,返回在此字符串中第一次出现的指定子字符串的索引。
substring() 方法返回字符串的子字符串。可以理解为字符串截取
public String substring(int beginIndex)
或
public String substring(int beginIndex, int endIndex)
beginIndex -- 起始索引(包括)。
endIndex -- 结束索引(不包括)。
注意:这两个参数都为int类型
子字符串。
replace() 方法通过用 newChar 字符替换字符串中出现的所有 searchChar 字符,并返回替换后的新字符串。
public String replace(char searchChar, char newChar)
searchChar -- 原字符。
newChar -- 新字符。
替换后生成的新字符串。
先来看响应html

响应获取
的55348f4b-a6f1-4db8-bb3a-677255d987c7值
具体方法如下:
public static String getCrsf(String resoust){String a = "/>\n" +"
来看下结果:

str3就是想要的结果:
哈哈哈哈------------str3-----------=a01eb715-8663-46b2-adc1-eb8d3d4906a4
上一篇:[附源码]Python计算机毕业设计SSM家教管理系统(程序+LW)
下一篇:RE2:Simple and Effective Text Matching with Richer Alignment Features