DEV Community

Discussion on: The advantages of various types of strings in Rust

Collapse
drsensor profile image
DrsEnsor

Most of the time you probably want CString instead of String for handling user input. Unlike String, CString automatically remove any 0 bytes ("nul characters").

I'm still looking on how to remove all non-printable chars in String (UTF-8)

Collapse
veer66 profile image
Vee Satayamas Author

Is a non-printable character a control character?

Collapse
drsensor profile image
DrsEnsor • Edited on

I think what I mean is non-graphic character which consist of both Unicode Control Character (Cc, Cf, Cs, Co, Cn) and Separator Format Character (Zl, Zp)

ref: Unicode General Category