VOOZH about

URL: https://www.geeksforgeeks.org/go-language/strings-tovalidutf8-function-in-golang-with-examples/

⇱ strings.ToValidUTF8() Function in Golang With Examples - GeeksforGeeks


  • Courses
  • Tutorials
  • Interview Prep

strings.ToValidUTF8() Function in Golang With Examples

Last Updated : 17 May, 2020
strings.ToValidUTF8() Function in Golang is used to returns a copy of the string s with each run of invalid UTF-8 byte sequences replaced by the replacement string, which may be empty. Syntax:
func ToValidUTF8(str, rep string) string
Here, str is string which may contain invalid UTF-8 and rep is the replacement string. Return Value: It returns the replaced string. Example 1: Output:
This is GeeksForGeeks
Example 2: Output:
GeeksForGeeks
Comment
Article Tags:

Explore