[点晴永久免费OA]C# Left, Right and Mid函数
当前位置:点晴教程→点晴OA办公管理信息系统
→『 经验分享&问题答疑 』
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 编辑过 |
关键字查询
相关文章
正在查询... |