473,418 Members | 2,088 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,418 software developers and data experts.

How to separate a string into char array

ad
I have a string vaiable like "1a3345";

How to separate the string into a char array or a string array just have on
character per element?
Nov 17 '05 #1
2 34549
ad wrote:
I have a string vaiable like "1a3345";

How to separate the string into a char array or a string array just have on
character per element?

string s = "1a3345";
char[] c = s.ToCharArray();

Hope it helps,
Andrey
Nov 17 '05 #2
psg
"ad" <ad@wfes.tcc.edu.tw> wrote in message
news:e$**************@TK2MSFTNGP09.phx.gbl...
I have a string vaiable like "1a3345";

How to separate the string into a char array or a string array just have
on
character per element?


string by itself can be accessed as an array of chars
*********************************
string s = "1a3345";
char c = s[1];
Console.WriteLine(c);
*********************************
will give you "a" as an output

RGDS PSG
Nov 17 '05 #3

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

Similar topics

4
by: J. Campbell | last post by:
I'm a novice with c/c++ and have been reading Eckel's book. I'd like some feedback on using this method. What I need to do is treat a string as numeric data. I know how to write functions to...
3
by: Mark Miller | last post by:
I have a char array and when I write it to a file using BinaryWriter the position of the pointer is the size of the array + 1. For example: writing char leaves the pointer at position 26 after...
27
by: Trep | last post by:
Hi there! I've been having a lot of difficult trying to figure out a way to convert a terminated char array to a system::string for use in Visual C++ .NET 2003. This is necessary because I...
6
by: A_StClaire_ | last post by:
hi, wrote the following program to learn a bit about auto pointers. weird thing is, the char array 'name' with size 'max_size' displays a bunch of messed up symbols after the "John Smith" if...
3
by: Kueishiong Tu | last post by:
How do I copy the content of a string in one encoding (in my case big5) to a char array of the same encoding? I try the following String line = S"123æ°´æ³¥"; char buffer; for(int i=0;...
2
by: Amrit Kohli | last post by:
Hello. I have the following code, to do a simple operation by copying the elements of a vector of strings into an array of char pointers. However, when I run this code, the first element in the...
7
by: Felix85 | last post by:
I am trying to make a command interpreter for a mud that i am working on the problem i am having right now is that i cannot convert the string into a char array. This is the error I am getting...
13
by: Superman859 | last post by:
Hello everyone. Heads up - c++ syntax is killing me. I do quite well in creating a Java program with very few syntax errors, but I get them all over the place in c++. The smallest little things...
2
by: nagesh0280 | last post by:
Hi experts, I'm from a Verilog HDL background and trying to learn C. There are a lot of similarities between Verilog and C but the concept of char arrays and strings has me confused. I'd...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
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...

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.