Returns the string that represents a fragment with the given unichar, pos and total.
| 1023 | // Returns the string that represents a fragment |
| 1024 | // with the given unichar, pos and total. |
| 1025 | STRING CHAR_FRAGMENT::to_string(const char *unichar, int pos, int total, |
| 1026 | bool natural) { |
| 1027 | if (total == 1) return STRING(unichar); |
| 1028 | STRING result = ""; |
| 1029 | result += kSeparator; |
| 1030 | result += unichar; |
| 1031 | char buffer[kMaxLen]; |
| 1032 | snprintf(buffer, kMaxLen, "%c%d%c%d", kSeparator, pos, |
| 1033 | natural ? kNaturalFlag : kSeparator, total); |
| 1034 | result += buffer; |
| 1035 | return result; |
| 1036 | } |
| 1037 | |
| 1038 | CHAR_FRAGMENT *CHAR_FRAGMENT::parse_from_string(const char *string) { |
| 1039 | const char *ptr = string; |
no test coverage detected