remove_control_characters {piecemaker} | R Documentation |
Unicode includes several control codes, such as U+0000
(NULL, used in
null-terminated strings) and U+000D
(carriage return). This function
removes all such characters from text.
remove_control_characters(text)
text |
A character vector to clean. |
Note: We highly recommend that you first condense all space-like characters
(including new lines) before removing control codes. You can easily do so
with str_squish
. We also recommend validating text at
the start of any cleaning process using validate_utf8
.
The character vector without control characters.
remove_control_characters("Line 1\nLine2")