Answers for "C# file remove \n"

C#
0

c# remove newline from string

// Remove all newlines from the 'example' string variable
string cleaned = example.Replace("n", "").Replace("r", "");
Posted by: Guest on August-04-2020
0

how clear all line in text file and write new string in c#

if (File.Exists(ModuleListPath))
            {
                File.WriteAllText(ModuleListPath, String.Empty);
            }

            foreach (var item in list)
            {
                using (StreamWriter stream = new StreamWriter(ModuleListPath,true))
                {
                    try
                    {
                        stream.WriteLine(item);
                        
                    }
                    catch
                    {
                        trow;
                    }
                }
            }
Posted by: Guest on October-02-2020

C# Answers by Framework

Browse Popular Code Answers by Language