Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

Read file and split line one by one 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

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 :: deactivate a gameobject unity 
Csharp :: Call Thread in C# 
Csharp :: how to add event function from code in wpf 
Csharp :: .net json result status code not working 
Csharp :: linq map array 
Csharp :: how to update model in entity framework db first approach 
Csharp :: listview thread error 
Csharp :: C# Blocks with statements 
Csharp :: start a particle effect when a button is pushed 
Csharp :: monegame deltatime 
Csharp :: c# custom event handler with parameters 
Csharp :: Options Pattern startup.cs configuration 
Csharp :: how to serialize a property in unity 
Csharp :: wpf change foreground c# 
Csharp :: c# Case insensitive Contains(string) 
Csharp :: unity color alpha not working 
Csharp :: unity deactivate scripts in list 
Csharp :: unity collapse hierarchy script 
Csharp :: rename join table ef core 
Csharp :: use or in shell script 
Csharp :: length of list c# 
Csharp :: dapper get list 
Csharp :: c# get out of for loop 
Csharp :: tachyons 
Csharp :: scaffold db 
Csharp :: c# sbyte 
Csharp :: how to show a first item in a combobox in c# winforms 
Csharp :: serialize object to json 
Csharp :: ontriggerenter unity not working 
Csharp :: unity animation length 
ADD CONTENT
Topic
Content
Source link
Name
9+7 =