Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. string[] lines = doc.Split('n');
  2. for (int i = 0; i < lines.Length; i+= 1)
  3. lines[i] = lines[i].Trim();
  4.  
  5. string path = "yourfile.txt";
  6. string[] lines = File.ReadAllLines(path);
  7.  
  8. string content = File.ReadAllText(path);
  9. string[] lines = content.Split(
  10. Environment.NewLine.ToCharArray(),
  11. StringSplitOptions.RemoveEmptyEntries);
  12.  
  13. string line = String.Empty;
  14. StreamReader reader = new StreamReader(path);
  15. while ((line = reader.ReadLine()) != null)
  16. {
  17. // do stuff
  18. }
  19.  
  20. StreamReader reader = new StreamReader(file);
  21. string _Line = reader.ReadToEnd();
  22. string IntMediateLine = string.Empty;
  23. IntMediateLine = _Line.Replace("entersign", "");
  24. string[] ArrayLineSpliter = IntMediateLine.Split('any specail chaarater');
  25.  
  26. private static string[] Split(string s, string delim)
  27. {
  28. if (s == null) throw new NullReferenceException();
  29.  
  30. // Declarations
  31. var strings = new ArrayList();
  32. var start = 0;
  33.  
  34. // Tokenize
  35. if (delim != null && delim != "")
  36. {
  37. int i;
  38. while ((i = s.IndexOf(delim, start)) != -1)
  39. {
  40. strings.Add(s.Substring(start, i - start));
  41. start = i + delim.Length;
  42. }
  43. }
  44.  
  45. // Append left over
  46. strings.Add(s.Substring(start));
  47.  
  48. return (string[]) strings.ToArray(typeof(string));
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement