Connecting Tech Pros Worldwide Forums | Help | Site Map

Break string length when it has reached the max.

Newbie
 
Join Date: Jun 2008
Location: chennai
Posts: 5
#1: Jun 25 '08
I have a ASP page that displays text and when somebody does this zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzzz zzzzzzzzzzzzzzzzzzzzzzzzzzzz it breaks the page. How to restrict this and how to break this single line as multiple line display that as like a paragraph.Can anyone help me...... Thanks.

jhardman's Avatar
Moderator
 
Join Date: Jan 2007
Location: logan, utah
Posts: 2,690
#2: Jun 25 '08

re: Break string length when it has reached the max.


Are you saying it breaks the visual formatting of the page?

I'm not sure how you would code it in JScript, but in VBScript, it would be something like this:
Expand|Select|Wrap|Line Numbers
  1. do until longString = ""
  2.    if len(longString) < 101 then
  3.       response.write longString
  4.       longString = ""
  5.    else
  6.       leftside = left(longString, 100)
  7.       if instr(leftside, " ") = 0 then
  8.          response.write leftside & " "
  9.          longString = right(longString, len(longString)-100)
  10.       else
  11.          response.write left(longString, instr(longString, " ")) & " "
  12.          longString = right(longString, len(longString)-instr(longString, " "))
  13.       end if
  14.    end if
  15. loop
I hope the conversion to jscript isn't too hard, let me know if this helps.

Jared
Reply


Similar ASP / Active Server Pages bytes