behavior of string.midb(0,string.LenB)

I just hurt myself with this one. I had copied & pasted some code that used MemoryBlock.MidB into a method where the variable was a String not a memoryBlock. As a result, I was calling String.MidB(0,string.LenB) on a string. What would you expect to get?

Turns out MidB on strings is one-based, and if you pass in 0 for the start location, you lose one letter on the end. Not sure if this is a bug or a “gotcha”?

Hmm, think this might be a “gotcha”. I think most “Basic” languages uses one-based indexing for strings. Personally I prefer 0-based indexing over one-based indexing.

That’s a gotcha. If you used -1 as a starting index, you’d get two characters chopped off the end.