-----------------------------[ This is a test ]-----------------------------
I wanted to be able to easily colorize it, so I made the string input to the function use cecho as the printing method, and came across an interesting problem: all the tags count towards the string length, but are not printed to the screen. This means that the total length of the bar was wrong on everything that included color tags.
I'm sure someone else will come across this problem, so here's the solution:
All this does is give you a string containing only the actual text from the line by replacing anything in brackets with nothing. A simpler example, if you just want the length, is: