Actually, I tried this function and it works fine for me.  What are you passing into the function? what's the purpose?
Here's a test that passes in cgi.query_string

gives a cryptic strring as a return.
http://dev.mxconsulting.com/sergv2/testSTringUdf.cfm?object=true

Throws an error:
http://dev.mxconsulting.com/sergv2/testSTringUdf.cfm

Throws an error:
http://dev.mxconsulting.com/sergv2/testSTringUdf.cfm?o

If the string is less than 1 character long it throws an error.

I can only assume that something is crazy about the value being passed IN to the function.

This function appears to take items and shift the ascii character code value 3 to the left.  I'm guessing that the ascii
character code in some cases is less than 3 causing some sort of end marker to be placed and thus befuddling your
"len( )".
I would do something like:

if(tempStr LT 4)
    tempStr = tempStr + 254;

Then your values would "wrap" through the ascii code table.

-Mark

  -----Original Message-----
  From: Calvin Ward [mailto:[EMAIL PROTECTED]
  Sent: Wednesday, October 08, 2003 3:16 PM
  To: CF-Talk
  Subject: Re: Ok, I give up UDF error

  What does this do for you?

  <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);
              }
     strReturn = 'Too Short:' & newstr & ':end';
     if (len(newstr)+1)
      strReturn = left(newstr,len(newstr)-1);
      }
  </cfscript>

  - Calvin
    ----- Original Message -----
    From: Mark W. Breneman
    To: CF-Talk
    Sent: Wednesday, October 08, 2003 3:52 PM
    Subject: RE: Ok, I give up UDF error

    Good question, but no, I have ran the output several times and checked
    all values none are blank.

    Mark W. Breneman
    -Cold Fusion Developer
    -Network Administrator
      Vivid Media
      [EMAIL PROTECTED]
      www.vividmedia.com
      608.270.9770

    -----Original Message-----
    From: Matthew Walker [mailto:[EMAIL PROTECTED]
    Sent: Wednesday, October 08, 2003 2:44 PM
    To: CF-Talk
    Subject: Re: Ok, I give up UDF error

    Is your input string empty?
      ----- Original Message -----
      From: Mark W. Breneman
      To: CF-Talk
      Sent: Thursday, October 09, 2003 8:37 AM
      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