如何获取位于两个其他声明的字符串之间的字符串,例如:
String 1 = "[STRING1]"
String 2 = "[STRING2]"
Source:
"832h0ufhu0sdf4[STRING1]I need this text here[STRING2]afyh0fhdfosdfndsf"
我怎样才能得到"I need this text here"
?
由于这是家庭作业,只有线索:
- Find
index1
的发生String1
- Find
index2
的发生String2
- Substring from
index1+lengthOf(String1)
(inclusive) to index2
(exclusive) is what you need
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)