using System.Collections.Generic;
public static void Main()
string newSamName = "abxy";
List<string> users = new List<string>();
string sam = "abcdefghijklmnopqrst";
Console.WriteLine(sam.Length);
public static string appendNumberSAM(this string sam, int n)
sam = sam.Remove(sam.Length - n.ToString().Length);
if(sam.Length + n.ToString().Length > 20)
int spacesAvailable = 20 - sam.Length;
sam = sam.removeFromEnd(n.ToString().Length - spacesAvailable);
public static class Extensions
public static string removeFromEnd(this string s, int n)
throw new ArgumentException("Es können nicht mehr Zeichen entfernt werden, als der String lang ist");
return s.Remove(s.Length - n);