How come...
Posted: Mon Mar 12, 2012 4:23 pm
This was a discussion somewhere else in the forum in the past, in a different aspect, but I can't find it now so i'll re-ask the question in a more direct manner then what i remember that other discussion being:
How come PB string functions like FindString, StringByteLength, etc....exclude the terminating null of a string in their returns?
a string "123456" - Len("123456") = 6 - StringByteLength("123456") = 6 - FindString("123456", Chr(0), 1) = 0 (or FindString("123456", #Null$, 1) = 0)
strings in PB consume memory at "string length + 1" (so I assume strings in PB automatically include a terminating null)
How come PB string functions like FindString, StringByteLength, etc....exclude the terminating null of a string in their returns?
a string "123456" - Len("123456") = 6 - StringByteLength("123456") = 6 - FindString("123456", Chr(0), 1) = 0 (or FindString("123456", #Null$, 1) = 0)
strings in PB consume memory at "string length + 1" (so I assume strings in PB automatically include a terminating null)