I have a file gg.txt with this text:
L = 4
H = 5
T = E
# ## ## ## ### ### ## # # ### ## # # # # # ### # ## # ## ## ### # # # # # # # # # # ### ###
# # # # # # # # # # # # # # # # # ### # # # # # # # # # # # # # # # # # # # # # # # #
### ## # # # ## ## # # ### # # ## # ### # # # # ## # # ## # # # # # # ### # # # ##
# # # # # # # # # # # # # # # # # # # # # # # # # # ## # # # # # # # # ### # # # #
# # ## ## ## ### # ## # # ### # # # ### # # # # # # # # # ## # ### # # # # # # ### #
As you can see, it's an alphabet. L is the character length; H is the character height. (They will always stay 4 and 5.) T is the character that I want print,. So, if T=E, I need to print only the image for E in the console.
###
#
##
#
###
If I will change T in txt, for example to B, the program will print B. I don't have any ideas how to do this or start, here is my starting code:
class Program
{
static void Main(string[] args)
{
string[] fileContent = File.ReadAllLines("gg.txt");
Console.WriteLine(string.Join("", fileContent));
Console.ReadKey();
}
}
If I understood you correctly, you want to keep only the substrings part of a given character so if T is a char and there is nothing else in the file than what you showed:
int charIndex = (int)T - (int)'A';
int startPos = charIndex * L;
foreach (string line in File.ReadLines("gg.txt"))
{
Console.WriteLine(line.Substring(startPos, L));
}
Note that you probably want to validate T and L before executing this.