Hrm - I think your only solution might be to use a hash table that matches
chars to ASCII codes then parse each string character by character doing a
look-up for each one?
"Eduardo Hernandez" <ehernandezg@12 3mail.cl> wrote in message
news:ea757fb5.0 311031836.52681 c3e@posting.goo gle.com...[color=blue]
> I need to transform a string into an array of integer numbers that
> correspond to the code ascii of each character.
>
> Thanks.
> Eduardo Hernández[/color]
Eduardo Hernandez said:[color=blue]
>
>I need to transform a string into an array of integer numbers that
>correspond to the code ascii of each character.[/color]
var str="antidisest ablishmentarian ism";
var code=new Array(str.lengt h);
for(var i=0;i<str.lengt h;i++){
code[i]=str.charCodeAt (i);
}
charCodeAt() actually returns the Unicode value, but that's
the same as ASCII for the first 128 values.
On Tue, 3 Nov 2003, Lee wrote:[color=blue][color=green]
> >I need to transform a string into an array of integer numbers that
> >correspond to the code ascii of each character.[/color]
>
> var str="antidisest ablishmentarian ism";
> var code=new Array(str.lengt h);
> for(var i=0;i<str.lengt h;i++){
> code[i]=str.charCodeAt (i);
> }
>
>
> charCodeAt() actually returns the Unicode value, but that's
> the same as ASCII for the first 128 values.[/color]
I've written a few usefull prototypes, that does this kinda stuff. Feel
free to use :)
Lee wrote:
[color=blue]
> Eduardo Hernandez said:[color=green]
>>I need to transform a string into an array of integer numbers that
>>correspond to the code ascii of each character.[/color]
>
> var str="antidisest ablishmentarian ism";
> var code=new Array(str.lengt h);
> for(var i=0;i<str.lengt h;i++){
> code[i]=str.charCodeAt (i);
> }[/color]
var code = str.split("");
for (var i = 0; i < code.length; i++)
code[i] = code[i].charCodeAt(0);
Comment