Log In  


Is it possible to get string lengths that ignore P8SCII codes?

t="\F6HELLO"
print(#t) returns 7

I would like it to return 5

Thanks,
Jim



Hi @z80jim. You could do what I did years ago as strings ruled every bit of code I had. I had a function I used quite often called VLEN which was for virtual length of string.

For instance, you could have VLEN("AP*723PLE") and that would get you a length of 6 since the "*" represents the next 3-characters is to be printed raw from characters 000-767, and it is only a single 8x8 pixeled character.

So you could make a comprehensive FOR/NEXT loop like I did to either recognize or skip over P8SCII codes.


Hi @dw817. Thanks for the response. I already started doing that, which is working fine especially since I am only currently using a couple codes. Was just hoping to avoid it of course. It seems like it would be a good built-in function but that is part of the fun of Pico-8. :)



[Please log in to post a comment]