Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Split text in line using c#

 		/// 08/04/2022 Mahesh Kumar Yadav. <br/>
        /// <summary>
        /// Read file and split line one by one
        /// </summary>
        internal static void ReadFileAndSplitByLine(string filePath)
        {
            using (var streamReader = File.OpenText(filePath))
            {
                var text = streamReader.ReadToEnd();
                var lines = text.Split(new[] { Environment.NewLine }, StringSplitOptions.None);
                foreach (var line in lines)
                {
                    Console.WriteLine(line);
                }
            }
        }
Comment

array of strings by splitting lines c#

string[] lines = theText.Split(
    new string[] { Environment.NewLine },
    StringSplitOptions.None
);
Comment

split lines c#

string[] lines = theText.Split(
    new string[] { "
", "
", "
" },
    StringSplitOptions.None
);
Comment

read all lines split C#

List<string[]> list = File.ReadLines("YourFile.txt")
                          .Select(r => r.TrimEnd('#'))
                          .Select(line => line.Split(','))
                          .ToList();
Comment

PREVIOUS NEXT
Code Example
Csharp :: web page search c# 
Csharp :: c# online compiler 
Csharp :: how to send button name for method in c# 
Csharp :: how to get an arrays length in c# 
Csharp :: c# get all classes derived from type 
Csharp :: .net 6 autofac 
Csharp :: yield in c# 
Csharp :: unity respawn c# 
Csharp :: Get Last Access Time Of Directory C# 
Csharp :: carousel asp.net mvc beginner 
Csharp :: encrypt with public key and decrypt with private key c# 
Csharp :: how to use curl in asp.net c# 
Csharp :: append an array in c# 
Csharp :: sequelize top 
Csharp :: Allow edit in Datagrid C# 
Csharp :: c# remove time in datetime 
Csharp :: c# bool to int 
Csharp :: class in c# 
Csharp :: wpf datagrid get selected items 
Csharp :: working with registry in c# 
Csharp :: div element position in screen 
Csharp :: math with c sharp 
Csharp :: asp.net core authorization default policy 
Csharp :: setting the parent of a transform which resides in a prefab 
Csharp :: ASP.net ApplicationUser referance not found 
Csharp :: monegame deltatime 
Csharp :: unity inspector draw line 
Csharp :: c# external ip 
Csharp :: create blazor server 
Csharp :: get first number in string C# 
ADD CONTENT
Topic
Content
Source link
Name
8+8 =