Hello Nim community
To communicate with RS232 serial port and microcontroleur, I use strutils to decode my serial string (Hex Data). count function seems not good working when i want to count non ascii table.
import strutils
var s: string = "hello hello hello \xFF\xFF\x00\x00\xFF\xFF\x00\x00\xFF\xFF \x68\x65\x6C\x6C\x6F"
echo s.toHex #68656C6C6F2068656C6C6F2068656C6C6F20FFFF0000FFFF0000FFFF2068656C6C6F
echo s #hello hello hello ������ hello
echo count(s, "hello") # return 3 => ok
echo count(s, "\x68\x65\x6C\x6C\x6F") # return 3 => ok
echo count(s, "\xFF") # return 6 => ok
echo count(s, "\xFF\xFF") # return 1 ??????? must be 3