Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add .remove() and .replaceAll() functions #26

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Remove nullable for replaceAll and remove
tspoke committed Nov 10, 2023
commit 20a92b3325a30f0bcaf0feee4b60bfc7c6fe072f
4 changes: 2 additions & 2 deletions lib/flutter_emoji.dart
Original file line number Diff line number Diff line change
@@ -293,7 +293,7 @@ class EmojiParser {
///
/// For example: replace('I ❤️ coffee', '??') => 'I ?? coffee'
///
String? replaceAll(final String text, final String toSymbol) {
String replaceAll(final String text, final String toSymbol) {
if (toSymbol.isEmpty){
return removeEmojis(text);
}
@@ -304,7 +304,7 @@ class EmojiParser {
/// Remove all emojis from the input text, removing double spaces
///
/// For example: removeEmojis('I ❤️ Flutter just like ☕') => 'I Flutter just like '
String? removeEmojis(final String text, {removeDoubleSpaces = true}) {
String removeEmojis(final String text, {removeDoubleSpaces = true}) {
final result = _mapEmojis(text, (String _) => '');
if (removeDoubleSpaces) {
return result.replaceAll(RegExp(r'\s\s+'), ' ');