473,385 Members | 1,185 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,385 software developers and data experts.

Creating a char or String from ascii code

Hi
Can anyone tell me how to create an instance of a char or string from
an ascii character code.

That is if I wont to create a tab char (code 0009), how would I achieve
this.

I know about the slash characters \t and \n etc. but I need to be able
to do this manually.
Thanks

Nov 25 '05 #1
3 30901
Hi Phil,
I am not very sure what you meant with "manually", but it seems you
wanted some thing like this:
either
char c = '\u0009';
or
char c = '\x0009'
will work.
More on the C# lang spec.

Thi - http://thith.blogspot.com

Nov 25 '05 #2
Many thnaks worked a treat....

Nov 25 '05 #3
Phil Mc wrote:
Can anyone tell me how to create an instance of a char or string from
an ascii character code.


The easiest way is just to cast it:

int i = 9;
char c = (char)i;

Call ToString on the char to get a string.

Jon

Nov 25 '05 #4

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

Similar topics

2
by: glenn | last post by:
I have a character lets say A and I want to see what the ASCII code is for that ie: 65. now to take 65 and make a C i would use: string str = (char)65; What is the process to go the other way...
7
by: ad | last post by:
How to retrun a character with ascii code? It is useChr(65) return 'A' in VB.NET. What is the equivalent function in C#?
39
by: Abubakar | last post by:
I want to get characters for given ascii codes. Dont wanna use the CHR or ChrW functions. What r the .NET equivilents of the Chr & ChrW functions? Regards, Abubakar.
9
by: Nick | last post by:
hi, I want to know if a string contain any unicode character, and what I did is like this: for(int i = 0 ; i < str.Length; i++) { char ch = str; //Then, right here, how to tell this char is...
7
by: Joris De Groote | last post by:
Hi, I have a 1 dimensional table byte with a number af characters in ASCII code. How do I convert those ASCII codes to real letters? Thanks
19
by: many_years_after | last post by:
Hi,everyone: Have you any ideas? Say whatever you know about this. thanks.
8
by: ianenis.tiryaki | last post by:
i couldnt figure out how i am supposed to find the ASCII code is there any way to do it? and main problem is i am not sure so i wanted to ask is it going to display 'a' ? am i right? What is...
2
by: Maj | last post by:
Hello! Even i've read smth about this in this forums.. i still have problems with getting the ascii code of a character. here is my problem I have a string with characters. I have another int...
1
by: DennBen | last post by:
Does anyone know how to query a field in a table where it contains an ASCII code >= 128 - without looping through every field for every record in table (using charindex)? Ex of char I would like...
3
by: pavanponnapalli | last post by:
hi, how can i change a character into its equivalent ascii code? I have used ascii(char) function, but i has not worked. cheers, pavan
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
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...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.