Break String after 80 chars
I need to write a function that checks the len of a string.
if the length of the string is > than 80 characters then find the nearest space and break the line there, continuing to check if the remainder of the string is > than 80 characters, and so on.
pseudocode
Code:
if(Len(request("comments")) > 80) then
if(80th char in string is space) then
break to a new line and write the rest of the string
also checking if remainder of string is > than 80 if it is
then repeat
else
look backwards in the string to find a space and break it there
also checking if remainder of string is > than 80 if it is
then repeat
end if
else
response.write(request("comments"))
end if
any help would be appreicated.