I'm stuck. Where can I add "Trim" to this C# statement? Each line will be a separate file name. But because each file may have space after it, I'd like to trim it off.
string[] lines = (File.ReadAllLines(@"C:\Users\Jim\Desktop\adminkeys.cfg"));
Thanks
If you are trying to trim each line, then you need to do it line by line, for example, with LINQ:
string[] lines = (File.ReadAllLines(@"C:\Users\Jim\Desktop\adminkeys.cfg"))
.Select(l => l.Trim()).ToArray();
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With