is_valid_utf8
stringChecks if a string contains valid UTF-8 encoding
Syntax
is_valid_utf8(string) Parameters
string (string) The string to validate
Returns
boolean True if string is valid UTF-8, false otherwise
Examples
Input:
is_valid_utf8("hello") Output:
true Input:
is_valid_utf8("café") Output:
true The is_valid_utf8() function checks whether a string contains valid UTF-8 encoded characters. Returns true if valid, false otherwise.
Usage
Use is_valid_utf8() to validate text encoding, filter invalid data, or ensure data quality when processing text from various sources.