DecodeCharacter returns the next character from an array of bytes A character is a rune along with any accompanying combining runes
(b []byte)
| 29 | // DecodeCharacter returns the next character from an array of bytes |
| 30 | // A character is a rune along with any accompanying combining runes |
| 31 | func DecodeCharacter(b []byte) (rune, []rune, int) { |
| 32 | r, size := utf8.DecodeRune(b) |
| 33 | b = b[size:] |
| 34 | c, s := utf8.DecodeRune(b) |
| 35 | |
| 36 | var combc []rune |
| 37 | for isMark(c) { |
| 38 | combc = append(combc, c) |
| 39 | size += s |
| 40 | |
| 41 | b = b[s:] |
| 42 | c, s = utf8.DecodeRune(b) |
| 43 | } |
| 44 | |
| 45 | return r, combc, size |
| 46 | } |
| 47 | |
| 48 | // DecodeCharacterInString returns the next character from a string |
| 49 | // A character is a rune along with any accompanying combining runes |
no test coverage detected