Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

convert string to array c#

string myString = "foobar";
char[] myCharArray = myString.ToCharArray();

/* Example of myCharArray
{'f', 'o', 'o', 'b', 'a', 'r'}
*/
Comment

string to array c#

public List<string> ArrayFromString(string str)
{
    var sb = new StringBuilder();
    var ls = new List<string>();
    for (int i = 0; i < str.Length; i++)
    { 
        if(str[i]>=65 && str[i]<=90 || str[i]>=97 && str[i]<=122) 
          sb.Append(str[i]);
        else
        {
            if(sb.Length>0) 
              ls.Add(sb.ToString());
            sb.Clear();
        }
    }
    if(sb.Length>0)
    {
      	ls.Add(sb.ToString());
    }
    return ls;
}
Comment

c# convert string to array

"Mohammad".ToCharArray().Select(c => c.ToString()).ToArray()
Comment

PREVIOUS NEXT
Code Example
Csharp :: c# get executing file name 
Csharp :: how to edit .csproj file 
Csharp :: c# streamreader to file 
Csharp :: unity awake 
Csharp :: c# max sequence contains no elements 
Csharp :: C# how to know if number is even or odd 
Csharp :: 2d array rows and columns in c# 
Csharp :: c# copy bidimensional array 
Csharp :: c# temporary files 
Csharp :: c# datagridview cell align center 
Csharp :: How to get selected item from Dropdown in GridView 
Csharp :: unity normalize movement 
Csharp :: array sum c# 
Csharp :: convert rgb to float 
Csharp :: c sharp async 
Csharp :: convert list of string to dictionary 
Csharp :: c# datetime 
Csharp :: how to set a color of text in unity 2020 script 
Csharp :: Check if list contains any of another list 
Csharp :: Transpose Matrix CSharp 
Csharp :: how to call a method from a class c# 
Csharp :: c# webclient vs httpclient 
Csharp :: wpf dispatcher timer is inaccurate 
Csharp :: read system data dataset 
Csharp :: dadar pincode 
Csharp :: empty int array c# 
Csharp :: what is napalm made of 
Csharp :: asp.net session empty cehck 
Csharp :: Make Enemy follow and rotate towards target in Unity 
Csharp :: in c# show error when user choose old datetime 
ADD CONTENT
Topic
Content
Source link
Name
7+3 =