If the variable newstr is only 1 char (or a zero length string) - this is the error you will get. Output the value of
"len(newstr) and see what you get.

-Mark

  -----Original Message-----
  From: Mark W. Breneman [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 08, 2003 2:38 PM
  To: CF-Talk
  Subject: Ok, I give up UDF error

  This seems so simple. All I want to do is to trim the last char from the
  return string.  I keep getting this error "Parameter 2 of function Left
  which is now -1 must be a positive integer"

  If I hard code a value in the UDF works with out a problem.  But when I
  put in the len(newstr)-1  into the "left" function it seems to evaluate
  to 0.

  Can anyone help me out?

  <cfscript>

  function qdecode(urlvars){

              var tempurlvars = URLDecode(urlvars);

              var strlen = len(tempurlvars);

              var tempstr = "";

              var i = 1;

              var newstr = "";

              for(i=1;i lte strlen;i=i+1) {

                          tempstr = Asc(Mid(tempurlvars, i, 1));

                          newstr = newstr & Chr(tempstr - 3);

              }

              return left(newstr,len(newstr)-1);

  }

  </cfscript>

  Mark W. Breneman

  -Cold Fusion Developer

  -Network Administrator

    Vivid Media

    [EMAIL PROTECTED]

    www.vividmedia.com

    608.270.9770



[Todays Threads] [This Message] [Subscription] [Fast Unsubscribe] [User Settings]

Reply via email to