| 666 | } |
| 667 | |
| 668 | int _hx_utf8_char_code_at(String inString, int inIndex) |
| 669 | { |
| 670 | #ifdef HX_SMART_STRINGS |
| 671 | if (!inString.raw_ptr() || inIndex>=inString.length) |
| 672 | return 0; |
| 673 | if (inString.isUTF16Encoded()) |
| 674 | return inString.raw_wptr()[inIndex]; |
| 675 | else |
| 676 | return inString.raw_ptr()[inIndex]; |
| 677 | #else |
| 678 | const unsigned char *src = (const unsigned char *)inString.__s; |
| 679 | const unsigned char *end = src + inString.length; |
| 680 | const unsigned char *sLen = getUtf8LenArray(); |
| 681 | |
| 682 | for(int i=0;i<inIndex;i++) |
| 683 | { |
| 684 | src += sLen[*src]; |
| 685 | if (src==end) |
| 686 | return 0; |
| 687 | if (src>end) |
| 688 | hx::Throw(HX_CSTRING("Invalid UTF8")); |
| 689 | } |
| 690 | return DecodeAdvanceUTF8(src,end); |
| 691 | #endif |
| 692 | } |
| 693 | |
| 694 | int _hx_utf8_length(String inString) |
| 695 | { |
nothing calls this directly
no test coverage detected