摘要: string str ="welcome to bejing , hello china,jiyou wuhan"; Dictionary<char, int> dict = new Dictionary<char, int>(); for (int i = 0; i < str.Length; i 阅读全文
posted @ 2020-10-15 16:11 Nanyingming 阅读(661) 评论(0) 推荐(0) 编辑
摘要: Console.WriteLine("请输入一段字符串:"); string str = Console.ReadLine(); char[] chs = new char[str.Length]; int i = 0; //将字符串转成数组; foreach (var item in str) { 阅读全文
posted @ 2020-10-15 15:27 Nanyingming 阅读(918) 评论(0) 推荐(0) 编辑
摘要: //将一个数组中的奇数放到一个集合中,再将偶数放到另一个集合中 //最终将两个集合合并为一个集合,并且奇数显示在左边 偶数显示在右边。 阅读全文
posted @ 2020-10-15 15:25 Nanyingming 阅读(340) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespac 阅读全文
posted @ 2020-10-15 08:39 Nanyingming 阅读(275) 评论(0) 推荐(0) 编辑
摘要: using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace _03StringJoin { class Pr 阅读全文
posted @ 2020-10-12 17:49 Nanyingming 阅读(585) 评论(0) 推荐(0) 编辑
摘要: //功能:去除掉"a,b-,cde,!,q,wcdes+-976"中的",+-!",重新组成一个数字符串;如:"abcdeqwcdes976" ; //字符串分割;将"a,b-,cde,!,q,wcdes+-976";string str = "a,b-,cde,!,q,wcdes+-976";st 阅读全文
posted @ 2020-10-12 17:37 Nanyingming 阅读(596) 评论(0) 推荐(0) 编辑
摘要: private void SavetxtData_Click(object sender, EventArgs e) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.Filter = "(*.txt)|*. 阅读全文
posted @ 2020-10-12 17:18 Nanyingming 阅读(4789) 评论(0) 推荐(0) 编辑
摘要: #region // 1、去掉特殊符号,将字符串反转; 方法1: string str = "AB,CD+E-F+G,HI-J,K-Nansen"; string[] strArr = str.Split(new char[] { ',', '+', '-' }, StringSplitOption 阅读全文
posted @ 2020-10-12 17:14 Nanyingming 阅读(747) 评论(0) 推荐(0) 编辑
摘要: //C#字符串反转 1、手动写一个方法 string str = "ABCDEFG"; char[] chsArr = str.ToCharArray(); for (int i = 0; i < chsArr.Length /2; i++) { char temp = chsArr[i]; chs 阅读全文
posted @ 2020-10-12 16:57 Nanyingming 阅读(2509) 评论(0) 推荐(0) 编辑