#PB_String_WithZero for StringByteLength()
Posted: Mon Dec 19, 2016 1:25 pm
In accordance with #PB_String_NoZero for PokeS() and PeekS()
http://www.purebasic.com
https://www.purebasic.fr/english/
Code: Select all
StringByteLength(String.s)+SizeOf(Character)
Code: Select all
Macro StringByteLengthN(String, Format = #PB_Ascii + #PB_Compiler_Unicode)
(StringByteLength(String, Format) + 1 + Bool(Format = #PB_Unicode))
EndMacro
Debug StringByteLengthN("Hello")
Debug StringByteLengthN("Hello", #PB_Ascii)
Debug StringByteLengthN("Hello", #PB_UTF8)
Debug StringByteLengthN("Hello", #PB_Unicode)