take_while_m_n splits a string slice with multibyte characters (e.g., arab letters) at the wrong position. input.position(condition) returns the byte to split at (6 in the following example case) while input.splice_index(idx) takes that byte position as char index and translates that index to byte index (9 in the example), effectively splitting at the wrong byte position (9 instead of 6).
take_while_m_n
splits a string slice with multibyte characters (e.g., arab letters) at the wrong position.input.position(condition)
returns the byte to split at (6
in the following example case) whileinput.splice_index(idx)
takes that byte position as char index and translates that index to byte index (9
in the example), effectively splitting at the wrong byte position (9
instead of6
).rustc 1.67.1 (d5a82bbd2 2023-02-07)
7.1.3
Test case
Example test case:
Output: