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

P#114086 2022-07-08 21:47 ( Edited 2022-07-08 21:49)

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.

P#114093 2022-07-09 01:14 ( Edited 2022-07-09 19:13)

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. :)

P#114110 2022-07-09 12:57

[Please log in to post a comment]

Follow Lexaloffle:          
Generated 2024-04-19 12:40:54 | 0.015s | Q:11