-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathUtilities.cs
More file actions
35 lines (29 loc) · 899 Bytes
/
Utilities.cs
File metadata and controls
35 lines (29 loc) · 899 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace Code_Abbey_Solutions
{
public class Utilities
{
public static List<int> ReadFile(string problem)
{
string[] stringArray = new string[] {};
foreach (var line in System.IO.File.ReadLines(Environment.CurrentDirectory + @$"/Text Files/Problem {problem}.txt"))
{
stringArray = stringArray.Concat(line.Split(" ")).ToArray();
}
return ArrayToList(stringArray);
}
public static List<int> ArrayToList(string[] stringArray)
{
List<int> intData = new List<int>();
foreach (string number in stringArray)
{
intData.Add(Int32.Parse(number));
}
return intData;
}
}
}