Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: SV: Re: SV: Re: Weird error..?


Message #1 by "SD-Studios" <info@s...> on Tue, 21 May 2002 16:56:16 +0200
I'll just send over the whole code.. =)

<!--
// BEGINNING OF WORDWRAP
-->
<%
Dim strTextPreWrap
Dim strTextPostWrap
Dim intWrapPosition

strTextPreWrap = rs("comment")

intWrapPosition = CInt(0)
If intWrapPosition = 0 Then intWrapPosition = 23

strTextPostWrap = WordWrap(strTextPreWrap, intWrapPosition)

Function WordWrap(strTextToBeWrapped, intMaxLineLength)
     Dim strWrappedText           ' Result storage

     Dim intLengthOfInput         ' Length of original

     Dim intCurrentPosition       ' Where we're at now
     Dim intCurrentLineStart      ' Where the current line starts
     Dim intPositionOfLastSpace   ' Last space we saw

     intLengthOfInput = Len(strTextToBeWrapped)

     intCurrentPosition = 1
     intCurrentLineStart = 1

     Do While intCurrentPosition < intLengthOfInput

          If intCurrentPosition = intCurrentLineStart + intMaxLineLength
Then

               strWrappedText = strWrappedText _
                    & Trim(Mid(strTextToBeWrapped, intcurrentLineStart)) _
                    & vbCrLf

               intCurrentLineStart = intCurrentPosition + 1

               Do While Mid(strTextToBeWrapped, intCurrentLineStart, 1) = "
"
                    intCurrentLineStart = intCurrentLineStart + 1
               Loop
          End If

          intCurrentPosition = intCurrentPosition + 1
     Loop

     strWrappedText = strWrappedText & Trim(Mid(strTextToBeWrapped, _
          intcurrentLineStart)) & vbCrLf

     WordWrap = strWrappedText
End Function

Function AddBrToCrLf(strInput)
     AddBrToCrLf = Replace(strInput, vbCrLf, "<br />" & vbCrLf)
End Function
%>
<!--
// END OF WORDWRAP
-->

Please help..!
--
MVH, Martin Johansson
CEO & Project Supervisor
SD-Studios
+46 (0)70-3003320
http://www.sd-studios.com


-----Ursprungligt meddelande-----
Från: Ken Schaefer [mailto:ken@a...]
Skickat: den 21 maj 2002 08:56
Till: ASP Databases
Ämne: [asp_databases] Re: SV: Re: Weird error..?


So your code looks like:

<%
'
strTextPostWrap = WordWrap(strTextPreWrap, intWrapPosition)

Function WordWrap(strTextToBeWrapped, intMaxLineLength)
    ' Stuff here
End Function
%>

?

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "SD-Studios" <info@s...>
Subject: [asp_databases] SV: Re: Weird error..?


: Here's the lines before:
:
: Dim strTextPreWrap
: Dim strTextPostWrap
: Dim intWrapPosition
:
: strTextPreWrap = rs("comment")
:
: intWrapPosition = CInt(0)
: If intWrapPosition = 0 Then intWrapPosition = 23
:
: strTextPostWrap = WordWrap(strTextPreWrap, intWrapPosition)
:
: Umm.. It has nothing to do with ASP and DB:s, but Im just desperate =)..
: Could you help me out anyway maybe?
: --
: MVH, Martin Johansson
: CEO & Project Supervisor
: SD-Studios
: +46 (0)70-3003320
: http://www.sd-studios.com
:
:
: -----Ursprungligt meddelande-----
: Från: Ken Schaefer [mailto:ken@a...]
: Skickat: den 17 maj 2002 04:59
: Till: ASP Databases
: Ämne: [asp_databases] Re: Weird error..?
:
:
: What is the line *before* this one? You don't have a line continuation
: character at the end of the previous line do you?
:
: Also, what does this have to do with using ASP & Database? :-)
:
: Cheers
: Ken
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
: From: "SD-Studios" <info@s...>
: Subject: [asp_databases] Weird error..?
:
:
: : Hi!
: : I've been trying to use a wordwrapper to wrap some text. Problem is, Im
: : getting a weird error.. why?
: :
: : Here it is:
: : Microsoft VBScript compilation error '800a03ea'
: :
: : Syntax error
: :
: : /cdos/develop2/top.asp, line 123
: :
: : Function WordWrap(strTextToBeWrapped, intMaxLineLength)
: : ^
: :
: : This is the code:
: : Function WordWrap(strTextToBeWrapped, intMaxLineLength)
: :      Dim strWrappedText
: :
: :      Dim intLengthOfInput
: :
: :      Dim intCurrentPosition
: :      Dim intCurrentLineStart
: :      Dim intPositionOfLastSpace
: :
: :      intLengthOfInput = Len(strTextToBeWrapped)
: :
: :      intCurrentPosition = 1
: :      intCurrentLineStart = 1
: :
: :      Do While intCurrentPosition < intLengthOfInput
: :
: :           If intCurrentPosition = intCurrentLineStart + intMaxLineLength
: : Then
: :
: :                strWrappedText = strWrappedText _
: :                     & Trim(Mid(strTextToBeWrapped, intcurrentLineStart))
_
: :                     & vbCrLf
: :
: :                intCurrentLineStart = intCurrentPosition + 1
: :
: :                Do While Mid(strTextToBeWrapped, intCurrentLineStart, 1)

: "
: : "
: :                     intCurrentLineStart = intCurrentLineStart + 1
: :                Loop
: :           End If
: :
: :           intCurrentPosition = intCurrentPosition + 1
: :      Loop
: :
: :      strWrappedText = strWrappedText & Trim(Mid(strTextToBeWrapped, _
: :           intcurrentLineStart)) & vbCrLf
: :
: :      WordWrap = strWrappedText
: : End Function
:
: ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:
:
:
:




  Return to Index