I'm trying to figure out the size of a string -- in other words, I want to know how many characters it contains. So the string containing "Hello", for example, should give me "5".

So this is what I tried: the code below was supposed to display how long the string was, but I never got anything other than 20 (I tried different string sizes, different variable names, etc.). Here's my code:

Internally, strings are always 20 long, this is no coincidence, it's the amount of characters you can put on the screen.

That's one of the quirks about RobotC that always trips me. IMHO, strings can be used in a lot of situations, not just displaying on the LCD screen. For example, I could do string manipulation to/from a file. Limiting it to 20 characters seems short sighted. Another example is limiting the debug stream with the same restriction. And I can't even print a string with more than 2 substitutions.

Who is online

Users browsing this forum: No registered users and 2 guests

You cannot post new topics in this forumYou cannot reply to topics in this forumYou cannot edit your posts in this forumYou cannot delete your posts in this forumYou cannot post attachments in this forum