Left Sring Function in C Sharp
In C# non esiste una funzione di sistema per recuperare la Left di una stringa.
Ecco lo snippet:
public static string Left(string text, int length) { if (length < 0) throw new ArgumentOutOfRangeException("length", length, "length must be > 0"); else if (length == 0 || text.Length == 0) return ""; else if (text.Length <= length) return text; else return text.Substring(0, length); }
Lascia un commento