473,473 Members | 1,577 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

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 32385
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: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.