Intelligently chops a String at a word boundary (whitespace) that occurs
at the specified index in the argument or before. However, if there is a
newline character before length
, the String will be chopped
there. If no newline or whitespace is found in string
up to
the index length
, the String will chopped at
length
.
For example, chopAtWord("This is a nice String", 10) will return
"This is a" which is the first word boundary less than or equal to 10
characters into the original String.