static public string GetNextRoomId(string currentId) { if (LatinAlphabet == null) { LatinAlphabet = new List <char>(); for (char c = 'A'; c <= 'Z'; ++c) { LatinAlphabet.Add(c); } } string newId; if (currentId != null && currentId.Length > 0) { char lastChar = currentId[currentId.Length - 1]; int nextCharIndex = LatinAlphabet.IndexOf(lastChar) + 1; if (nextCharIndex >= LatinAlphabet.Count) { newId = currentId + LatinAlphabet[0].ToString(); } else { newId = LatinAlphabet[nextCharIndex].ToString(); } } else { newId = LatinAlphabet[0].ToString(); } return(newId); }
/// <summary> /// Lists the small letters. /// </summary> /// <returns>All small letters.</returns> public static IEnumerable <string> SmallLetters() => LatinAlphabet.SmallLetters();
/// <summary> /// Lists the capital letters. /// </summary> /// <returns>All captial letters.</returns> public static IEnumerable <string> CapitalLetters() => LatinAlphabet.CapitalLetters();