Thank you so much, I have been looking on the net for so long, nowhere did I find it as simply as you've stated. Thank you for saving me a lot of time.
Thank you for the note, I am just doing c++ as a university thing where our demonstrators really only care about the code working so I don't always keep best practices in mind. I will remind myself to pass by reference and use size_t instead of .size()
About lines 52 to 54, if you don't mind me asking, how are those lines no good?
I will include this explanation as the comment above it is a little bad:
the find() function with the (int) will return -1 if it cannot find the substring.
if the substring is found, it will return >=0
if we add one to the result, then we get 0 is substr is not found and >0 if found
this acts like a bool, no?
here is the comment I included in the original file for the implementation
@: will center text
#: will right justify text
$: will wrap and center text
/* these are some instructions on how to use this namespace
this namespace is intended for display() functions that use the stringstream stuff where, we incase the text to be displayed on one set of titleBars (see example below).
you can specify what parts need to be formatted with a with the abovementioned commands
@Welcome to this program!
@written by Zane
in the above example input we need to first calculate the len of the title bar
"~" thing and then format the console text accordingly using iomanip functions
we need to use the namespace's functions in the display functions of the classes,
so, the output (formated text) would look like this:
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ //this is a title bar, you can set the character type in the generateTitleBar()
Welcome to this program! //centered text
written by Zane //centered text
leftJustified rightJustified //right justified
wrapAndCenter //"\n" appended to the top and bottom, ie text is wrapped in "\n" and centered
leftJustified2 //left justified(no need to use namespace)