I'm stuck at this. I`m beginner into software development.
You get a list of N students and then a list of ratings for each student. A student which has bigger rating than his neighbour from list gets more candies than both of them. For example:
Data input:
3
John
Michael
Sam
9
10
8
Data Output:
John 1
Michael 3
Sam 1
I wrote this code, but I'm missing something:
using System.Diagnostics.CodeAnalysis;
using System.IO.Pipes;
{
int number = Convert.ToInt32(Console.ReadLine());
string[] studentsList = FillArray(number);
int[] studentsGrades = ConvertList(FillArray(number));
PrintResult(studentsList, CountCandies(int number));
}
static string[] FillArray(int number)
{
string[] result = new string[number];
for (int i = 0; i < number; i++)
{
result[i] = Console.ReadLine();
}
return result;
}
static int[] ConvertList(string[] array)
{
int[] result = new int[array.Length];
for (int i = 0; i < array.Length; i++)
{
result[i] = Convert.ToInt32(array[i]);
}
return result;
}
static int[] GetGrades(int number) // give grades of each student
{
int[] result = new int[number];
for (int i = 0; i < number; i++)
{
result[i] = Convert.ToInt32(Console.ReadLine());
}
return result;
}
static int CountCandies(int[] arr, int number) // this is the method where I'm stuck.
{
int sum = 0;
int[] ans = new int[number];
for (int i = 0; i < number; i++)
{
ans[i] = 1;
}
for (int i = 0; i < number-1; i++)
{
if (arr[i+1] > arr[i])
{
ans[i+1] =ans[i] +1;
}
}
for (int i = number-2; i>=0; i--)
{
if (arr[i] > arr[i+1] && ans[i] <= ans[i+1])
{
ans[i] = ans[i+1] +1;
}
sum += ans[i];
}
sum += ans[number-1];
return sum;
}
static void PrintResult(string[] array, int[] array2) // print the final result
{
for (int i = 0; i < array.Length; i++)
{
array[i] += " " + array2[i];
}
foreach (string student in array)
{
Console.WriteLine(student);
}
}
You definitely need an object to hold your data.
public class StudentRating
{
public string StudentName {get;set;}
public int Rating {get;set;}
}
protected List<StudentRating> studentsRating = new List<StudentRating>();
public static void Main(string[] args)
{
GeteringInformation();
//after this do what you want with your data
}
protected static GeteringInformation()
{
Console.WriteLine("Student name:");
int rating =Convert.ToInt32(Console.ReadLine());
Console.WriteLine("Rating");
string name =Console.ReadLine();
studentsRating.Add(new StudentRating(){StudentName=name,Rating=rating});
Console.WriteLine("Next? (Y/N)");
if(Console.ReadLine().ToLower()="y")
GeteringInformation();
}
Greetings fellow programmers, I need to ask you for a help.
I have this programm:
private void Import_CSV_Click(object sender, System.Windows.RoutedEventArgs e)
{
List<List<string>> x = new List<List<string>>();
try
{
List<string> row = new List<string>();
OpenFileDialog browseDialog = new OpenFileDialog();
browseDialog.Filter = "CSV Files (*.csv)|*.csv";
browseDialog.ShowDialog();
StreamReader sr = new StreamReader(browseDialog.FileName, Encoding.Default, true);
List<TOsoby> persons = new List<TOsoby>();
var file = sr.ReadToEnd();
var linesinthestream = file.Split(new char[] { '\n' });
for (int i = 0; i < linesinthestream.Count()-2; i++)
{
persons.Add(new TOsoby());
}
sr = new StreamReader(browseDialog.FileName, Encoding.Default, true);
string firstline = Akro.Helpers.String.RemoveDiacritics(sr.ReadLine().ToLower());
string[] values = firstline.Split(';');
for (int i = 0; i < values.Length; i++)
{
row.Add(values[i]);
}
x.Add(row);
while (!sr.EndOfStream)
{
row = new List<string>();
string lines = sr.ReadLine();
values = lines.Split(';');
for (int i = 0; i < values.Length; i++)
{
row.Add(values[i]);
}
x.Add(row);
}
for (int i = 0; i < x[0].Count-2; i++)
{
if (x[0][i] == "jmeno") //Tady je chyba J = 22. a count je 24 upakovaní neprojde.
{
for (int j = 0; j < x.Count-2; j++)
{
persons[j].Jmeno = x[j][i].ToString();
}
}
else if (x[0][i] == "name")
{
for (int j = 0; j < x.Count - 2; j++)
{
persons[j].Jmeno = x[j][i].ToString();
}
}
else if (x[0][i] == "firstname")
{
for (int j = 0; j < x.Count - 2; j++)
{
persons[j].Jmeno = x[j][i].ToString();
}
}
else if (x[0][i] == "prijmeni")
{
for (int j = 0; j < x.Count - 2; j++)
{
persons[j].Prijmeni = x[j][i].ToString();
}
}
else if (x[0][i] == "surname")
{
for (int j = 0; j < x.Count - 2; j++)
{
persons[j].Prijmeni = x[j][i].ToString();
}
}
else if (x[0][i] == "lastname")
{
for (int j = 0; j < x.Count - 2; j++)
{
persons[j].Prijmeni = x[j][i].ToString();
}
}
else if (x[0][i] == "familyname")
{
for (int j = 0; j < x.Count - 2; j++)
{
persons[j].Prijmeni = x[j][i].ToString();
}
}
else if (x[0][i] == "titul")
{
for (int j = 0; j < x.Count - 2; j++)
{
persons[j].Titul = x[j][i].ToString();
}
}
else if (x[0][i] == "title")
{
for (int j = 0; j < x.Count - 2; j++)
{
persons[j].Titul = x[j][i].ToString();
}
}
else if (x[0][i] == "email")
{
for (int j = 0; j < x.Count - 2; j++)
{
persons[j].Email = x[j][i].ToString();
}
}
else if (x[0][i] == "")
{
return;
}
for (int j = 0; j < x.Count - 2; j++)
{
persons[j].OsobaID = 0;
}
}
if (persons == null) //Musím odstranit [0], protože tam je uložený první řádek a taky potřebujeme tam dát 23 řádků, takže nám tam 2 entry chybí (Marie a Michal), ale 22. řádek je uložen jako "", takže to musíme nějak opravit.
{
return;
}
else
{
persons.RemoveAt(0); //Tohle opravý ten první řádek
EntitiesModel em = DB.GetDB();
em.Add(persons); //23 a 24 tam vůbec nejsou (lidi z excelu)
em.SaveChanges();
Checker.CheckAfterEverySave();
}
}
catch (Exception er)
{
MessageBox.Show(er.Message);
}
}
My quest is to read the CSV entries and save them into the database, my problem is that last two entries of my CSV are not inside the persons, also on the last index it is empty:
Here is my CSV example I generated:
How should I fix it please?
Have a look at this, I included comments where I did changes to your code.
var csvFile = "A;B;C\nA 1;B 1;C 1\nA 2;B 2;C 2\nA 3;B 3;C 3\nA 4;B 4;C 4\n";
List<List<string>> x = new List<List<string>>();
List<Foo> foos = new List<Foo>();
//use StringSplitOptions.RemoveEmptyEntries to remove potential empty line at the end
var linesinthestream = csvFile.Split(new char[] { '\n' }, StringSplitOptions.RemoveEmptyEntries);
for (int i = 0; i < linesinthestream.Length - 1; i++) //-1 instead of - 2
foos.Add(new Foo());
List<string> row = new List<string>();
string firstline = linesinthestream[0];
string[] values = firstline.Split(';');
for (int i = 0; i < values.Length; i++)
row.Add(values[i]);
x.Add(row);
//use linesinthestream instead of again reading a stream start for loop at 1 and not 0 to skip the header
//you could remove the above code to read the header with this and start at 0, you don't really do anything different
for (int i = 1; i < linesinthestream.Length; i++)
{
row = new List<string>();
string lines = linesinthestream[i];
values = lines.Split(';');
for (int j = 0; j < values.Length; j++)
row.Add(values[j]);
x.Add(row);
}
//remove -2 to read all columns
for (int i = 0; i < x[0].Count; i++)
{
if (x[0][i] == "A")
{
//remove -2, start loop at 1, fill foo[j-1]
for (int j = 1; j < x.Count; j++)
foos[j-1].HeaderA = x[j][i].ToString();
}
else if (x[0][i] == "B")
{
//remove -2, start loop at 1, fill foo[j-1]
for (int j = 1; j < x.Count; j++)
foos[j-1].HeaderB = x[j][i].ToString();
}
else if (x[0][i] == "C")
{
//remove -2, start loop at 1, fill foo[j-1]
for (int j = 1; j < x.Count; j++)
foos[j-1].HeaderC = x[j][i].ToString();
}
}
//moved this loop outside of the previous loop, don't need to do it for every column
for (int j = 1; j < x.Count; j++)
foos[j-1].Id = 0;
foreach(var foo in foos)
Console.WriteLine($"Id: {foo.Id} | HeaderA: {foo.HeaderA} | HeaderB: {foo.HeaderB} | HeaderC: {foo.HeaderC}");
Find a demo here:
https://dotnetfiddle.net/tj0azu
As was already pointed out you should consider usign a library eg.
https://github.com/JoshClose/CsvHelper
and you can achieve the same result with this code:
using System;
using CsvHelper;
using CsvHelper.Configuration;
using System.Globalization;
using System.IO;
public class Program
{
public static void Main()
{
var csvFile = "A;B;C\nA 1;B 1;C 1\nA 2;B 2;C 2\nA 3;B 3;C 3\nA 4;B 4;C 4\n";
using (var reader = new StringReader(csvFile))
using (var csvReader = new CsvReader(reader, new CsvConfiguration(CultureInfo.InvariantCulture) { Delimiter = ";" }))
{
csvReader.Context.RegisterClassMap<FooMap>();
var foos = csvReader.GetRecords<Foo>();
foreach(var foo in foos)
Console.WriteLine($"Id: {foo.Id} | HeaderA: {foo.HeaderA} | HeaderB: {foo.HeaderB} | HeaderC: {foo.HeaderC}");
}
}
}
public class Foo
{
public int Id {get;set;}
public string HeaderA {get;set;}
public string HeaderB {get;set;}
public string HeaderC {get;set;}
}
public sealed class FooMap : ClassMap<Foo>
{
public FooMap()
{
AutoMap(CultureInfo.InvariantCulture);
Map(m => m.Id).Ignore();
Map(m => m.HeaderA).Name("A");
Map(m => m.HeaderB).Name("B");
Map(m => m.HeaderC).Name("C");
}
}
Find a demo here:
https://dotnetfiddle.net/1jaYNw
I recommend using FileHelpers. There is a nuget package available. I have used this for parsing several CSV files with no issue.
Here is some example code that will read a CSV file through a Stream and create a List<T> of the class that is provided:
using FileHelpers;
using System;
using System.Collections.Generic;
using System.IO;
public class DataFileConverter<T> : IDisposable where T : class
{
private readonly IFileHelperAsyncEngine<T> _engine;
private bool _disposed = false;
public DataFileConverter()
{
_engine = new FileHelperAsyncEngine<T>();
}
~DataFileConverter()
{
Dispose(false);
}
public bool RemoveHeaderRow
{
get => _engine.Options.IgnoreFirstLines == 1;
set => _engine.Options.IgnoreFirstLines = value ? 1 : 0;
}
protected virtual void Dispose(bool disposing)
{
if (!_disposed)
{
if (disposing)
{
if (_engine != null)
{
_engine.Close();
}
}
_disposed = true;
}
}
public void Dispose()
{
Dispose(true);
GC.SuppressFinalize(this);
}
public List<T> ReadDataFile(Stream stream)
{
List<T> data = new List<T>();
using var streamReader = new StreamReader(stream);
using (_engine.BeginReadStream(streamReader))
{
foreach (T datum in _engine)
{
data.Add(datum);
}
}
return data;
}
}
using FileHelpers;
using System;
[DelimitedRecord(",")]
public class SomeClass
{
[FieldCaption("column1")]
public string SomeProperty1 { get; set; }
[FieldCaption("column2")]
[FieldConverter(ConverterKind.Date, "yyyy-MM-dd")]
public DateTime SomeProperty2 { get; set; }
}
public class SomeService
{
using DataFileConverter<SomeClass> converter = new DataFileConverter<SomeClass>
{
RemoveHeaderRow = true
};
List<SomeClass> data = converter.ReadDataFile(System.IO.File.OpenRead("path/to/file"));
// do whatever logic with data
}
So I am creating a hangman-type game in C# and I want the user's input to be recognized as a variable. So I am trying to use this variable(user input) and see if it is found in the word chosen. However, there is no .Contain function that works with "char" variables. Is there any way to make this work? (The part in asterisks is the portion I want to add this code to)
using System;
namespace Hangman
{
class WordChoice
{
static void Main(string[] args)
{
Random rand = new Random();
int numword = rand.Next(2);
string word = "";
char[] ltrlist = { ' ' };
char ltrchce = ' ';
int strlength = 0;
**void ltrcheck()
{
if
{
Console.WriteLine("Great you got a letter");
}
}**
if (numword == 1)
{
word = "Shrek";
strlength = word.Length;
ltrlist = new char[strlength];
for (int a = 0; a < strlength; a++)
{
ltrlist[a] = word[a];
}
}
if (numword == 2)
{
word = "Venom";
strlength = word.Length;
ltrlist = new char[strlength];
for (int a = 0; a < strlength; a++)
{
ltrlist[a] = word[a];
}
}
if (numword == 3)
{
word = "Avengers";
strlength = word.Length;
ltrlist = new char[strlength];
for (int a = 0; a < strlength; a++)
{
ltrlist[a] = word[a];
}
}
if (numword == 4)
{
word = "Inception";
strlength = word.Length;
ltrlist = new char[strlength];
for (int a = 0; a < strlength; a++)
{
ltrlist[a] = word[a];
}
}
if (numword == 5)
{
word = "Batman";
strlength = word.Length;
ltrlist = new char[strlength];
for (int a = 0; a < strlength; a++)
{
ltrlist[a] = word[a];
}
}
string undscr = "";
for (int i = 0; i < strlength; i++)
{
undscr = undscr + " _";
}
Console.WriteLine(undscr);
Console.WriteLine("");
Console.WriteLine("Pick a letter");
string ltrchcestr = Console.ReadLine();
ltrchce = Convert.ToChar(ltrchcestr);
ltrcheck();
}
}
}
You can do a function like this
static bool Contains(IEnumerable < char > items, char letter)
=> return items?.Any(c => c == letter) == true;
or just create a typeExtension, for Project wide use:
public static class CharExtensions {
public static bool Contains(this IEnumerable<char> items, char letter ){
return items?.Any(c => c == letter) == true;
}
}
this test will now work:
var chars = new []{'a','b','c'};
Console.WriteLine(chars.Contains('m'));
Console.WriteLine(chars.Contains('b'));
I trying to do sorting without use of any method or function
My Code :
string[] names = { "Flag", "Nest", "Cup", "Burg", "Yatch", "Next" };
string name = string.Empty;
Console.WriteLine("Sorted Strings : ");
for (int i = 0; i < names.Length; i++)
{
for (int j = i + 1; j < names.Length; j++)
{
for (int c = 0; c < names.Length; c++)
{
if (names[i][c] > names[j][c])
{
name = names[i];
names[i] = names[j];
names[j] = name;
}
}
}
Console.WriteLine(names[i]);
}
Please let me bring any solution for this code ?
In this code i am getting "Index was outside the bounds of the array" exception
int temp = 0;
int[] arr = new int[] { 20, 65, 98, 71, 64, 11, 2, 80, 5, 6, 100, 50, 13, 9, 80, 454 };
for (int i = 0; i < arr.Length; i++)
{
for (int j = i + 1; j < arr.Length; j++)
{
if (arr[i] > arr[j])
{
temp = arr[j];
arr[j] = arr[i];
arr[i] = temp;
}
}
Console.WriteLine(arr[i]);
}
Console.ReadKey();
You need to implement a sorting algorithm.
A very simple algorithm you can implement is the insertion sort:
string[] names = { "Flag", "Nest", "Cup", "Burg", "Yatch", "Next" };
for (int i = 0; i < names.Length; i++)
{
var x = names[i];
var j = i;
while(j > 0 && names[j-1].CompareTo(x) > 0)
{
names[j] = names[j-1];
j = j-1;
}
names[j] = x;
}
string[] names = { "Flag", "Next", "Cup", "Burg", "Yatch", "Nest" };
string name = string.Empty;
Console.WriteLine("Sorted Strings : ");
for (int i = 0; i < names.Length; i++)
{
int c = 0;
for (int j = 1; j < names.Length; j++)
{
if (j > i)
{
Sort:
if (names[i][c] != names[j][c])
{
if (names[i][c] > names[j][c])
{
name = names[i];
names[i] = names[j];
names[j] = name;
}
}
else
{
c = c + 1;
goto Sort;
}
}
}
Console.WriteLine(names[i]);
}
I you were conflicting in length of names array and comparing string. Below is the working solution . I have tested it it's working now
static void Main(string[] args)
{
int min=0;
string[] names = { "Flag", "Nest", "Cup", "Burg", "Yatch", "Next" };
string name = string.Empty;
Console.WriteLine("Sorted Strings : ");
for (int i = 0; i < names.Length-1; i++)
{
for (int j = i + 1; j < names.Length;j++ )
{
if(names[i].Length < names[j].Length)
min =names[i].Length;
else
min =names[j].Length;
for(int k=0; k<min;k++)
{
if (names[i][k] > names[j][k])
{
name = names[i].ToString();
names[i] = names[j];
names[j] = name;
break;
}
else if(names[i][k] == names[j][k])
{
continue;
}
else
{
break;
}
}
}
}
for(int i= 0;i<names.Length;i++)
{
Console.WriteLine(names[i]);
Console.ReadLine();
}
}
}
class Program
{
static void Main(string[] args)
{
int[] arr = new int[] {9,1,6,3,7,2,4};
int temp = 0;
for (int i = 0; i < arr.Length; i++)
{
for (int j = i + 1; j < arr.Length;j++)
{
if(arr[i]>arr[j])
{
temp = arr[j];
arr[j] = arr[i];
arr[i] = temp;
}
}
Console.Write(arr[i]+",");
}
Console.ReadLine();
}
for (int i = 0; i < names.Length; i++)
{
string temp = "";
for (int j = i + 1; j < names.Length; j++)
{
if (names[i].CompareTo(names[j]) > 0)
{
temp = names[j];
names[j] = names[i];
names[i] = temp;
}
}
}
public int compareing(string a, string b)
{
char[] one = a.ToLower().ToCharArray();
char[] two = b.ToLower().ToCharArray();
int ret = 0;
for (int i = 0; i < one.Length; i++)
{
for (int j = 0; j < two.Length; j++)
{
Loop:
int val = 0;
int val2 = 0;
string c = one[i].ToString();
char[] c1 = c.ToCharArray();
byte[] b1 = ASCIIEncoding.ASCII.GetBytes(c1);
string A = two[j].ToString();
char[] a1 = A.ToCharArray();
byte[] d1 = ASCIIEncoding.ASCII.GetBytes(a1);
int sec = d1[0];
int fir = b1[0];
if (fir > sec)
{
return ret = 1;
break;
}
else
{
if (fir == sec)
{
j = j + 1;
i = i + 1;
if (one.Length == i)
{
return ret = 0;
}
goto Loop;
}
else
{
return 0;
}
}
}
}
return ret;
}
public void stringcomparision(List<string> li)
{
string temp = "";
for(int i=0;i<li.Count;i++)
{
for(int j=i+1;j<li.Count;j++)
{
if(compareing(li[i],li[j])>0)
{
//if grater than it throw 1 else -1
temp = li[j];
li[j] = li[i];
li[i] = temp;
}
}
}
Console.WriteLine(li);
}
for (int i = 0; i < names.Length - 1; i++)
{
string temp = string.Empty;
for (int j = i + 1; j < names.Length; j++)
{
if (names[i][0] > names[j][0])
{
temp = names[i].ToString();
names[i] = names[j].ToString();
names[j] = temp;
}
}
}
for (int i = 0; i < names.Length - 1; i++)
{
int l = 0;
if (names[i][0] == names[i + 1][0])
{
string temp = string.Empty;
if (names[i].Length > names[i + 1].Length)
l = names[i + 1].Length;
else
l = names[i].Length;
for (int j = 0; j < l; j++)
{
if (names[i][j] != names[i + 1][j])
{
if (names[i][j] > names[i + 1][j])
{
temp = names[i].ToString();
names[i] = names[i + 1].ToString();
names[i + 1] = temp;
}
break;
}
}
}
}
foreach (var item in names)
{
Console.WriteLine(item.ToString());
}
string[] names = { "Flag", "Nest", "Cup", "Burg", "Yatch", "Next" };
string temp = "";
int tempX = 0, tempY = 0;
int tempX1 = 0, tempY1 = 0;
for (int i = 0; i<names.Length; i++)
{
for (int j = i+1; j<names.Length; j++)
{
if (((string)names[i])[0] > ((string)names[j])[0])
{
temp=(string)names[i];
names[i]=names[j];
names[j]=temp;
}
else if (((string)names[i])[0] == ((string)names[j])[0])
{
tempX=0; tempY=0;
tempX1=names[i].Length;
tempY1=names[j].Length;
while (tempX1 > 0 && tempY1 >0)
{
if (((string)names[i])[tempX] !=((string)names[j])[tempY])
{
if (((string)names[i])[tempX]>((string)names[j])[tempY])
{
temp=(string)names[i];
names[i]=names[j];
names[j]=temp;
break;
}
}
tempX++;
tempY++;
tempX1--;
tempY1--;
}
}
}
}
You can do it using bubble sort:
Assume you have the array of names called name
The tempName is just to not change the original array (You can use the original array instead)
void sortStudentsAlphabetically()
{
int nameIndex;
string temp;
string[] tempName = name;
bool swapped = true;
for(int i = 0; i < name.Length-1 && swapped ; i++)
{
swapped = false;
for(int j = 0; j < name.Length-1; j++)
{
nameIndex = 0;
recheck:
if (name[j][nameIndex]> name[j+1][nameIndex])
{
temp = tempName[j];
tempName[j] = tempName[j+1];
tempName[j+1] = temp;
swapped = true;
}
if (name[j][nameIndex] == name[j + 1][nameIndex])
{
nameIndex++;
goto recheck;
}
}
}
foreach(string x in tempName)
{
Console.WriteLine(x);
}
}
User Below code :
int[] arrayList = new int[] {2,9,4,3,5,1,7};
int temp = 0;
for (int i = 0; i <= arrayList.Length-1; i++)
{
for (int j = i+1; j < arrayList.Length; j++)
{
if (arrayList[i] > arrayList[j])
{
temp = arrayList[i];
arrayList[i] = arrayList[j];
arrayList[j] = temp;
}
}
}
Console.WriteLine("Sorting array in ascending order : ");
foreach (var item in arrayList)
{
Console.WriteLine(item);
}
Console.ReadLine();
Output:
Sorting array in ascending order : 1 2 3 4 5 7 9
I have some string in format like that
XXXX-XXXX-X_X_
All "_" should be replaced with Letters and numberst to prodce sth like that:
XXXX-XXXX-XAXA
XXXX-XXXX-XAXB
XXXX-XXXX-XAXC
XXXX-XXXX-XAXD
XXXX-XXXX-XAXE
XXXX-XXXX-XAXF
XXXX-XXXX-XAXG
(...)
XXXX-XXXX-XZX8
XXXX-XXXX-XZX9
XXXX-XXXX-X0XA
(...)
XXXX-XXXX-X2XA
XXXX-XXXX-X2XB
I know hoe to make it with one "_".
string alphaLetters = "ABCDEFGHIJKLMNOPQRSTUWXYZ0123456789ABCDEF";
foreach (char letter in alphaLetters.ToCharArray())
{
Numbers.Add(number.Replace('_', letter)));
}
I want this code to be working with unknown number of "_".
Can you help?
IMHO it must be recursive. (Note: that does not mean it must use recursive method call, although I used recursive call in the following code, it can be easily converted to internal recursion stack. )
public static void RunSnippet()
{
var r = new List<string>();
Replace("asd_asd_asd_".ToCharArray(), 0, r);
foreach(var s in r) { Console.WriteLine(s); }
}
public static char[] possibilities = new char[] { 'A', 'B', 'C' };
public static void Replace(char[] chars, int startIndex, IList<string> result)
{
for (int i = startIndex; i < chars.Length; i++)
{
if (chars[i] != '_')
{
continue;
}
// we found first '_'
for (int j = 0; j < possibilities.Length; j++)
{
chars[i] = possibilities[j];
Replace(chars, i + 1, result);
}
chars[i] = '_'; // take back what we replaced
return; //we're done here
}
// we didn't find any '_', so all were replaced and we have result:
result.Add(new string(chars));
}
Try this one:
var alphaIndexes = new List<int>();
string alphaLetters = "ABCDEFGHIJKLMNOPQRSTUWXYZ0123456789ABCDEF";
for(int n = 0; n<Numbers.Count; n++) {
char[] numberLetters = Numbers[n].ToCharArray();
int position = 0;
for(int i = numberLetters.Length - 1; i>=0; i--) {
if(numberLetters[i] == '_') {
int alphaIndex = 0;
if(alphaIndexes.Count <= position)
alphaIndexes.Add(0);
else {
alphaIndex = alphaIndexes[position];
}
numberLetters[i] = alphaLetters[alphaIndex];
position++;
}
}
if(alphaIndexes.Count > 0) {
alphaIndexes[0]++;
for(int j = 0; j < alphaIndexes.Count; j++) {
if(alphaIndexes[j] >= alphaLetters.Length) {
alphaIndexes[j] = 0;
if (j < alphaIndexes.Count)
alphaIndexes[j+1]++;
}
}
}
Numbers[n] = new String(numberLetters);
Numbers[n].Dump();
}