[點晴永久免費OA]C# Left, Right and Mid函數(shù)
當(dāng)前位置:點晴教程→點晴OA辦公管理信息系統(tǒng)
→『 經(jīng)驗分享&問題答疑 』
class LeftRightMid { static void Main(string[] args) { string myString = "This is a string"; Console.WriteLine(Left(myString, 4)); Console.WriteLine(Right(myString, 6)); Console.WriteLine(Mid(myString, 5, 4)); Console.WriteLine(Mid(myString, 5)); Console.ReadLine(); } public static string Left(string param, int length) { string result = param.Substring(0, length); return result; } public static string Right(string param, int length) { string result = param.Substring(param.Length - length, length); return result; } public static string Mid(string param, int startIndex, int length) { string result = param.Substring(startIndex, length); return result; } public static string Mid(string param, int startIndex) { string result = param.Substring(startIndex); return result; } }
該文章在 2017/2/24 10:59:36 編輯過 |
關(guān)鍵字查詢
相關(guān)文章
正在查詢... |