摘要:
C# Parse 方法用于将字符串类型转换成任意类型,具体的语法形式如下。 数据类型 变量 = 数据类型.Parse(字符串类型的值); 这里要求等号左、右两边的数据类型兼容。 int num1 = int.Parse(Console.ReadLine()); int num2 = int.Pars 阅读全文
posted @ 2019-12-23 14:15
highlightyys
阅读(54)
评论(0)
推荐(0)
摘要:
class Program { static void Main(string[] args) { string str = Console.ReadLine(); str = str.Insert(1, "@@@"); Console.WriteLine("新字符串为:" + str); } } 阅读全文
posted @ 2019-12-23 13:40
highlightyys
阅读(661)
评论(0)
推荐(0)
摘要:
class Program { static void Main(string[] args) { string str = Console.ReadLine(); int firstIndex = str.IndexOf("@"); int lastIndex = str.LastIndexOf( 阅读全文
posted @ 2019-12-23 13:38
highlightyys
阅读(61)
评论(0)
推荐(0)
摘要:
class Program { static void Main(string[] args) { string str = Console.ReadLine(); if (str.IndexOf(",") != -1) { str = str.Replace(",", "_"); } Consol 阅读全文
posted @ 2019-12-23 10:12
highlightyys
阅读(70)
评论(0)
推荐(0)
摘要:
使用 IndexOf 方法查找第一个 @ 出现的位置与使用 LastlndexOf 方法查找 @ 在字符串中最后一次出现的位置相同即可 class Program { static void Main(string[] args) { string str = Console.ReadLine(); 阅读全文
posted @ 2019-12-23 10:09
highlightyys
阅读(25)
评论(0)
推荐(0)

浙公网安备 33010602011771号