2 Replies Latest reply on Feb 20, 2011 8:53 PM by Jimmathy

    charAt is returning ASCII values

    Jimmathy Level 1

      I'm running some script using the charAt() function, that is supposed to return the character at specific indexes in a string, however for some reason it is returning ASCII values. Any ideas of why this might be?

       

      thanks

        • 1. Re: charAt is returning ASCII values
          kglad Adobe Community Professional & MVP

          copy and paste enough of your code to see your string's definition and your charAt() method.


          • 2. Re: charAt is returning ASCII values
            Jimmathy Level 1


            Well thats where it gets a little nasty. This code is beign run on a smartfox server, and its pulling from a .mdb database cell, via SQL and jdbc-odbc driver. The cell has a 25 characters in it. And this data is in the object queryRes. The only thing that I can think of is that maybe oldString is being set to something other than a string somehow, but i havent gotten around to messing with checking that out yet.

             

            function processUpdate(params, queryRes, obj)
            {
            var tempRow = queryRes.get(params.mp-1);
            var newStringValue = "";
            var oldString = tempRow.getItem([params.mpy]);
            for( i = 0; i < 25; i++)
            {
              if(i != params.mpx)
              {
               newStringValue += oldString.charAt(i);
              }else if(i == params.mpx){
               if(obj == true){
                newStringValue += params.dato;
               }else{
                newStringValue += params.dat;
               }
              }
            }
            return newStringValue;
            }