-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add regex for removing non letters in answers
- Loading branch information
1 parent
cd212f0
commit 6f63922
Showing
3 changed files
with
15 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
11 changes: 11 additions & 0 deletions
11
tgBotService/src/main/java/weatherproject/tgbotservice/utils/RegExUtil.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
package weatherproject.tgbotservice.utils; | ||
|
||
public class RegExUtil { | ||
public static String removeNonLettersAndSpaces(String input) { | ||
// Регулярное выражение для замены всех символов, кроме букв и пробелов | ||
String regex = "[^a-zA-Z ]"; | ||
|
||
// Замена всех ненужных символов на пустую строку | ||
return input.replaceAll(regex, ""); | ||
} | ||
} |