473,320 Members | 1,841 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

how can I transform a string to code ascii?

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
Jul 20 '05 #1
4 32376
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" <eh*********@123mail.cl> wrote in message
news:ea**************************@posting.google.c om...
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

Jul 20 '05 #2
Lee
Eduardo Hernandez said:

I need to transform a string into an array of integer numbers that
correspond to the code ascii of each character.


var str="antidisestablishmentarianism";
var code=new Array(str.length);
for(var i=0;i<str.length;i++){
code[i]=str.charCodeAt(i);
}
charCodeAt() actually returns the Unicode value, but that's
the same as ASCII for the first 128 values.

Jul 20 '05 #3
On Tue, 3 Nov 2003, Lee wrote:
I need to transform a string into an array of integer numbers that
correspond to the code ascii of each character.


var str="antidisestablishmentarianism";
var code=new Array(str.length);
for(var i=0;i<str.length;i++){
code[i]=str.charCodeAt(i);
}
charCodeAt() actually returns the Unicode value, but that's
the same as ASCII for the first 128 values.


I've written a few usefull prototypes, that does this kinda stuff. Feel
free to use :)

http://www.svendtofte.com/code/usefull_prototypes/

Regards,
Svend
Jul 20 '05 #4
Lee wrote:
Eduardo Hernandez said:
I need to transform a string into an array of integer numbers that
correspond to the code ascii of each character.


var str="antidisestablishmentarianism";
var code=new Array(str.length);
for(var i=0;i<str.length;i++){
code[i]=str.charCodeAt(i);
}


var code = str.split("");
for (var i = 0; i < code.length; i++)
code[i] = code[i].charCodeAt(0);
PointedEars
Jul 20 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: John Lehmann | last post by:
I have an interesting problem. I am performing an XSL transform using the System.Xml.Xsl.Transform class. I have a database that contains the XSL style sheet string. And it seems to work pretty...
1
by: Tim Menninger | last post by:
When I use the XslTransform.Transform method to write to the HttpRequest.OutputStream The first byte of the output is always an invalid character, looks like an ascii zero or some other...
7
by: Doug Heeren | last post by:
I have the following section of VB.NET code that transforms a simple dataset into an Excel xml workbook. It works fine for < 50 rows or so, but I have about 8,000 rows I need to transform. Is there...
3
by: Andy | last post by:
Hi all, I'm having a problem doing an Xslt transform in code. I've done it before, so I'm not really sure why its not working. The problem is that the result of the transform is an empty...
11
by: Kai Bohli | last post by:
Hi all ! I need to translate a string to Ascii and return a string again. The code below dosen't work for Ascii (Superset) codes above 127. Any help are greatly appreciated. protected...
18
by: Ger | last post by:
I have not been able to find a simple, straight forward Unicode to ASCII string conversion function in VB.Net. Is that because such a function does not exists or do I overlook it? I found...
11
by: Gerald I. Evenden | last post by:
Working on a Kubuntu 64bit system "c++ (GCC) 4.0.3". The following simple program extracted from p.497 & 499 of N.M.Josurris' "The C++ Standard Library ... " (file t.cpp): 1 #include <string>...
3
KevinADC
by: KevinADC | last post by:
If you are entirely unfamiliar with using Perl to sort data, read the "Sorting Data with Perl - Part One and Two" articles before reading this article. Beginning Perl coders may find this article...
19
by: est | last post by:
From python manual str( ) Return a string containing a nicely printable representation of an object. For strings, this returns the string itself. The difference with repr(object) is that...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
1
by: Shćllîpôpď 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.