C# String ToCharArray()
Description
String ToCharArray()
copies the characters in this instance
to a Unicode character array.
Syntax
String.ToCharArray()
has the following syntax.
public char[] ToCharArray()
Returns
String.ToCharArray()
method returns
Example
The following example demonstrates how to easily create a Unicode character array from a String.
using System;/* ww w .java2s. com*/
public class StringSplit2
{
public static void Main()
{
string delimStr = " ,.:";
char[] delimiter = delimStr.ToCharArray();
for (int x = 1; x <= delimiter.Length; x++) {
Console.WriteLine(delimiter[x]);
}
}
}
The code above generates the following result.