unicode.utf8.utf8valid

LuaFAR 3

unicode.utf8.utf8valid


result, len = unicode.utf8.utf8valid (str)
    or
result, len = str:utf8valid ()

Parameters:
  str:     string

Returns:
  result:  boolean
  len:     integer

Description:
  This function tests whether the entire input string is valid UTF-8.
  If it is, the function returns true followed by the string length in characters.
  Otherwise, the function returns false followed by the number of valid UTF-8
  characters preceded the first invalid one.

Note:
  This is added function, not present in the original Selene Unicode library.