Recognize the number of symbols BYTE



  • The number of symbols in the line can be found:

    TCHAR* someStr = "Hello World!";
    size_t sizeStr = strlen(someStr);
    

    How to know the number of symbols in the bayt, for example:

    BYTE * someByte = "\xFF\xAA\x55";
    size_t sizeByte = strlen((TCHAR*)someByte );
    

    It's not working correctly, especially the young ones. How?



  • Yunikovod is different:

    Multibite (utf-8)

    ASCII-Z approach and class std:string But it's not the length of the line in the symbols, it's the number of byte.

    The symbol level with utf-8 standard C+++ is not supported - external libraries are needed.

    Bibite (utf-16)

    The type wchar_t* and class std will help:wstring, the rest in the same way as ASCII-Z, only the end of the line will be the word (16 bat) equal to 0.

    For these lines, there are analogs to eight-bit functions from standard library C, to measure length - wcslen()e.g.

    At the same time, the work of these analogs will be at the level of symbols.

    4Bay (utf-32)

    C+++ standard library is not maintained.




Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2