I just finished working on menu generator, but I need to add warning message or popup like this one :
the warning message, like the other elements of menu, should have same width of 80 (inner width is 78, because border takes two). I built a function with one parameter which can easy generate that message for the text that will be displayed. The problem is when I put text longer than 78 characters, I get errors. I want to split it into two (or more depending on how many lines we would get) parameters cause no one will count to 78 on each parameter/line. I'm looking for a possibility to split text into two or more lines to fit the inner width of 78.
Since this time I decided to split text with " "(space) separator
$textsplit = $text.Split(" ")
Then I decided to add each element of $textsplit
to an array using a Do-Until
loop
$warningmsgline1.Add($textsplit[$i])
$warningmsgline1.Add(" ")
to make a new variable that will contain a sentence (words) that contains less then 78 characters.
I hope you are keeping up :)
How can I create such a condition? Nested loops? What kind of loops? For? Do-Until?
Feel free to ask if something is unclear.