Hi,
How can I convert an array of chars into a string and vice
versa ?
char[] myChars = new char[10];
I want to convert these 10 chars into a single string, but
how ?
And if I have a single string, like
string ss = "abcdef";
How can I make an array of chars from this ?
Thx,
Alfons 4 1193
Alfons wrote: Hi,
How can I convert an array of chars into a string and vice versa ?
char[] myChars = new char[10];
I want to convert these 10 chars into a single string, but how ?
String str = new String(myChars);
And if I have a single string, like
string ss = "abcdef";
How can I make an array of chars from this ?
char[] myChars = new char[ss.Length];
str.CopyTo((0, myChars , 0, str.Length);
/Joakim
Alfons wrote: Hi,
How can I convert an array of chars into a string and vice versa ?
char[] myChars = new char[10];
I want to convert these 10 chars into a single string, but how ?
string str = new string(mychars);
And if I have a single string, like
string ss = "abcdef";
How can I make an array of chars from this ?
char[] chars = ss.ToCharArray();
It's all on MSDN...
-- http://www.joergjooss.de
mailto:ne********@joergjooss.de
Alfons wrote: char[] myChars = new char[10];
I want to convert these 10 chars into a single string, but how ?
string myString=new string(myChars);
And if I have a single string, like
string ss = "abcdef";
char[] myChars=ss.ToCharArray();
Anders Norås http://dotnetjunkies.com/weblog/anoras/
Joakim Karlsson wrote: char[] myChars = new char[ss.Length]; str.CopyTo((0, myChars , 0, str.Length);
Doh! Me stoopid! :)
Of course you should use:
char[] myChars = str.ToCharArray();
Bad Joakim! Bad! This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Simon Schaap |
last post by:
Hello,
I have encountered a strange problem and I hope you can help me to
understand it. What I want to do is to pass an array of chars to a
function that will split it up (on every location where...
|
by: Simon Schaap |
last post by:
Hello,
I have encountered a strange problem and I hope you can help me to
understand it. What I want to do is to pass an array of chars to a
function that will split it up (on every location where...
|
by: bearophileHUGS |
last post by:
Helmut Jarausch:
Asking in comp.compression is a good starting point.
My suggestions (sorry if they look a bit unsorted): it depends on what
language you want to use, how much you want to...
|
by: Christoph Zwerschke |
last post by:
In Python programs, you will quite frequently find code like the
following for removing a certain prefix from a string:
if url.startswith('http://'):
url = url
Similarly for stripping...
|
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...
|
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...
|
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...
|
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,...
|
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...
|
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers,...
|
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...
|
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...
|
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,...
| |