Skip to content

removeSpecialChar

Returns after removing all special characters, including spaces. If you want to allow any special characters as exceptions, list them in the second argument value without delimiters. For example, if you want to allow spaces and the symbols & and *, the second argument value would be ' &*'.

Parameters

NameTypeRequiredDefault
strstringStringstr
exceptionCharactersnamedkeywordstringStringstr

namedThese parameters are passed as named parameters.

keywordThese parameters are passed as keyword arguments, or as a single dict in their place.

Returns

string

String

str

Examples

javascript
removeSpecialChar('Hello-qsu, World!'); // Returns 'HelloqsuWorld'
removeSpecialChar('Hello-qsu, World!', ' -'); // Returns 'Hello-qsu World'
dart
removeSpecialChar('Hello-qsu, World!'); // Returns 'HelloqsuWorld'
removeSpecialChar('Hello-qsu, World!', exceptionCharacters: ' -'); // Returns 'Hello-qsu World'
python
removeSpecialChar('Hello-qsu, World!')  # Returns 'HelloqsuWorld'
removeSpecialChar('Hello-qsu, World!', ' -')  # Returns 'Hello-qsu World'

Released under the MIT License