String.Contains (SearchText) funktioniert nicht mehr als ein Wort

Post a reply

Smilies
:) :( :oops: :chelo: :roll: :wink: :muza: :sorry: :angel: :read: *x) :clever:
View more smilies

BBCode is ON
[img] is ON
[flash] is OFF
[url] is ON
Smilies are ON

Topic review
   

Expand view Topic review: String.Contains (SearchText) funktioniert nicht mehr als ein Wort

by Anonymous » 25 Aug 2025, 16:42

Ich habe Inhalte und versuche zu finden, ob das "SearchText" im Inhalt vorhanden ist. Wenn ich im "SearchText" nach einem einzelnen Wort suche, gibt der String.Contains (SearchText) True zurück, aber für mehr als ein Werk false zurück. Unten ist der Ausschnitt, der die Implementierung zeigt. Ich muss identifizieren, ob der Suchtext im Inhalt vorhanden ist. < /p>

boolean found;
String searchText = "particular text";
String input = "This is the text area where I am trying " +
"to look for the particular text, which is in the variable searchText. " +
"This text will have the string (222M) as part of this string. " +
"The find method should give me a true result even if I don't " +
"enter the closing brakect of the word. This is a multiline string";
if(input.contains(searchText)) {
found = true;
}
< /code>

muss ich Regex verwenden?
Lassen Sie mich auf die Forschung und meine Versuche hinweisen, die ich früher nicht erwähnt habe.pattern = Pattern.compile("(?

Top