String Formatting

Results 1 to 2 of 2

Thread: String Formatting

  1. #1
    Join Date
    Dec 1969

    Default String Formatting

    hi,<BR><BR>I&#039;m building a Javascript String array dynamically by retrieving a value from the database using ASP, inside a Javascript function. <BR><BR><BR>function build(){<BR>&#060;%<BR>response.write ("a[" & i &"]=&#039;" & rs(0) & "&#039;;" & chr(13))<BR>%&#062;<BR>....<BR>...<BR>}<BR><BR><BR >This works fine but sometimes I get a * runtime error "Unterminated String Constant" * as the string wraps to the next line if it is too long...<BR><BR>So in View&#124source it looks like this....<BR><BR>a[0]=&#039;Mary had little lamb whose fleece was white as <BR>snow&#039;;<BR><BR><BR>How can I make sure the entire string stays in the same line...<BR><BR>This is really wierd... need help urgently<BR><BR><BR><BR><BR><BR>

  2. #2
    Join Date
    Dec 1969

    Default RE: String Formatting

    I would think that there is a newline character in your string.<BR>So try this:<BR><BR>Replace(rs(0), chr(13), " ") in stead of rs(0)<BR><BR>or if you have a linefeed:<BR>Replace(rs(0), chr(10), " ")<BR>or even both:<BR>Replace(<BR>Replace(rs(0), chr(13), " "), chr(10), " ")<BR><BR>Other than this, I can think of nothing else that would wrap the string to the next line.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts