これらの単語を見つける方法がわかりません..例私はこのテキストを持っています...
The other day I went to the <location> and bought some <plural-noun> . Afterwards, I went to <location> , but it was very <adjective> so I left quickly and went to <location> .
何を検索すればいいのかわからず、Googleで検索する<
と>
無視されます。この文字列を取得する方法を教えてください。
だから私は、、、、<location>
を<plural-noun>
取得<location>
し<adjective>
ます<location>
charAt()
メソッドを使用する必要があります。私の試み:
String string = this.fileName;
for(int i = 0; i < string.length(); i++)
if((string.charAt(i) == '<') && (string.charAt(i) == '>'))
System.println(""); //<-------- IM STUCK HERE
わかりません...ほぼ2日間寝ていません。
私の現在の最後の問題です...表示されている各単語を削除する<
にはどうすればよいですか?>
String string = this.template;
Pattern pattern = Pattern.compile("<.*?>");
Matcher matcher = pattern.matcher(string);
List<String> listMatches = new ArrayList<String>();
while(matcher.find()) {
listMatches.add(matcher.group());
}
// System.out.println(listMatches.size());
int indexNumber = 1;
for(String s : listMatches) {
System.out.println(Integer.toString(indexNumber) + ". " + s);
indexNumber++;
}