GetFirst
public static string GetLast(this string source, int tailLength) { if (source == null || tailLength >= source.Length) return source; return source.Substring(source.Length - tailLength); }Example:
string number = "123456789".GetFirst(5); //12345
Description
get fist n charactor in string
Details
- Author: Phakawan Wongpetanan
- Submitted on: 2/22/2014 11:39:12 AM
- Language: C#
- Type: System.String
- Views: 1993
Double click on the code to select all.