- Sort Score
- Result 10 results
- Languages All
Results 1 - 2 of 2 for trimUTF8 (0.16 sec)
-
src/cmd/internal/test2json/test2json_test.go
b := []byte(s) for i := 0; i < len(s); i++ { j := trimUTF8(b[:i]) u := string([]rune(s[:j])) + string([]rune(s[j:])) if u != s { t.Errorf("trimUTF8(%q) = %d (-%d), not at boundary (split: %q %q)", s[:i], j, i-j, s[:j], s[j:]) } if utf8.FullRune(b[j:i]) { t.Errorf("trimUTF8(%q) = %d (-%d), too early (missed: %q)", s[:j], j, i-j, s[j:i]) } }
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Oct 26 19:50:36 UTC 2022 - 7.2K bytes - Viewed (0) -
src/cmd/internal/test2json/test2json.go
return !unicode.IsLower(r) } // trimUTF8 returns a length t as close to len(b) as possible such that b[:t] // does not end in the middle of a possibly-valid UTF-8 sequence. // // If a large text buffer must be split before position i at the latest, // splitting at position trimUTF(b[:i]) avoids splitting a UTF-8 sequence. func trimUTF8(b []byte) int { // Scan backward to find non-continuation byte.
Registered: Wed Jun 12 16:32:35 UTC 2024 - Last Modified: Wed Nov 09 17:33:07 UTC 2022 - 14.5K bytes - Viewed (0)