【发布时间】:2014-10-09 10:58:09
【问题描述】:
我有一个字符串。它的某些内容可以更改,某些内容是固定的。
是这样的:
String mycontent = "here is the sentence 1 . here is the sentence 2 . hereisthesomesentence3.here is the sentence 4. "
sentence 1 content : changeable ,
sentence 2 content : fixed ,
sentence 3 content : changeable ,
sentence 4 content : changeable .
我想取句子 3 的内容,比如
String sentence3 = "hereisthesomesentence3"
注意:我不知道有多少句子,因为部分字符串可以更改。我可以写出 10 或 20 句话。
我的字符串的内容是这样的:
some paragraphs in here.// i do not know what is it writing . After this changeable contents
fixed content :"url" // fixed content not change . But url can be change **i want to get url**
some other paragraphs in here // here some other contents.
示例代码 3:(我想获取我的 url;我们仍然有一些部分是可更改的,一些部分是固定的)
Some Other Paragraphs
FIXED TEXT
<span class="subcat2"><a href="myurl">
<span style="display: inline-block; float: left; color: #ccc !important;"></span> Hello World!!!!!!!!!!!!!!!!!!!!!!!!!!
</a></span>
Some Other Paragraphs
【问题讨论】:
-
只需使用
System.out.println("changeable"),因为内容是“可变的”... 飞走:D -
那么,这个字符串的结构看起来如何?
-
你在这里对sentence的定义是什么?你的意思是每次有一个句号,就开始一个新的句子?会不会出现像 “M. Smith 在 35.7 秒内洗完澡。”这样的句子??
-
这个字符串,我不知道它是什么内容。我只知道有些东西是固定的,它是恒定的。我想在恒定的单词之后获得内容。可能有