Skip to content

Instantly share code, notes, and snippets.

@TomoG29
Last active January 13, 2019 04:49
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save TomoG29/32838e9c1633d844ad163df67b0355ab to your computer and use it in GitHub Desktop.
Save TomoG29/32838e9c1633d844ad163df67b0355ab to your computer and use it in GitHub Desktop.
using System;
public static Dictionary<int, string> getTextFileDataDic(string FilePath)
{
string[] line = ((Resources.Load(FilePath, typeof(TextAsset)) as TextAsset).text).Split(char.Parse("\n"));
Dictionary<int, string> text = new Dictionary<int, string>();
for (int i = 0; i < line.Length; i++)
{
if (!string.IsNullOrEmpty(line[i]))
{
string[] SplitText = line[i].Split(char.Parse(","));
text.Add(int.Parse(SplitText[0]), SplitText[1]);
}
}
return text;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment