Centering LCD Screen Text

Hello forums,

I’m currently programming software that required me to print text strings of varying length (8, 9, 10, 10) in the center of the screen. The issue with this is that the printAt() and setCursor() functions all mean that the printed string is offset to the right. Has anybody found solutions to this?

use Brain.Screen.getStringWidth( str ) (where str is your string) to figure out the string width, then calculate start position based on that.

3 Likes