当前位置: 首页 > news >正文

html网页设计代码购物网站建设网站要多久到账

html网页设计代码购物网站,建设网站要多久到账,织梦网站seo,个人博客网页制作成品图片目录 一、使用的方法 1.使用Split(String, String)方法 2.String.Split 方法 二、源代码 1.源码 2.生成效果 使用正则表达式可以拆分指定的字符串。同样地#xff0c;使用字符串对象的Split方法也可以实现此功能。使用字符串对象的Split方法可以根据用户选择的拆分条件使用字符串对象的Split方法也可以实现此功能。使用字符串对象的Split方法可以根据用户选择的拆分条件方便地将字符串对象拆分为多个字符串。 一、使用的方法 1.使用Split(String, String)方法 在由正则表达式模式定义的位置将输入字符串拆分为一个子字符串数组。 public static string[] Split (string input, string pattern); 参数 input String 要拆分的字符串。pattern String 要匹配的正则表达式模式。返回 String[] 字符串数组。例外 ArgumentException 出现正则表达式分析错误。ArgumentNullException input 或 pattern 为 null。RegexMatchTimeoutException 发生超时。 有关超时的详细信息请参阅“备注”部分。 // 用正则表达式拆分字符串为一个子字符串数组 using System.Text.RegularExpressions;namespace _086_2 {public class Example{public static void Main(){string input 01-31-2024;string pattern (-)|(/);foreach (string result in Regex.Split(input, pattern)){Console.WriteLine({0}, result);}}} } // 运行结果 /* 01 - 31 - 2024*/2.使用String.Split 方法 String对象的Split(Char[])方法根据指定的分隔字符将字符串拆分为子字符串。 public string[] Split (params char[]? separator);参数 separator Char[] 分隔字符的数组、不包含分隔符的空数组或 null。返回 String[] 一个数组其元素包含此实例中的子字符串这些子字符串由 separator 中的一个或多个字符分隔。 有关详细信息请参阅“备注”部分。 // 将空格字符和制表 \t 符作为分隔符 namespace _086_1 {internal class Program{private static void Main(string[] args){ArgumentNullException.ThrowIfNull(args);string s Today\tIm going to school;string[] subs s.Split( , \t);foreach (var sub in subs){Console.WriteLine($Substring: {sub});//Console.WriteLine(Substring: {0}, sub);//等效语句}}} } // 运行结果 /* Substring: Today Substring: Im Substring: going Substring: to Substring: school*/下面来分享源代码吧 二、源代码 1.源码 // 使用Split(String, String)方法拆分字符串 // 使用String对象的Split(Char[])方法拆字符串。 using System.Text.RegularExpressions; namespace _086 {public partial class Form1 : Form{private GroupBox? groupBox1;private Button? button2;private Button? button1;private TextBox? textBox2;private TextBox? textBox1;private Label? label2;private Label? label1;public Form1(){InitializeComponent();Load Form1_Load;}private void Form1_Load(object? sender, EventArgs e){// // label1// label1 new Label{AutoSize true,Location new Point(6, 23),Name label1,Size new Size(68, 17),TabIndex 0,Text 源字符串};// // label2// label2 new Label{AutoSize true,Location new Point(6, 48),Name label2,Size new Size(68, 17),TabIndex 1,Text 子字符串};// // textBox1// textBox1 new TextBox{Location new Point(72, 17),Name textBox1,Size new Size(262, 23),TabIndex 2};// // textBox2// textBox2 new TextBox{Font new Font(Microsoft YaHei UI, 7F),Location new Point(72, 48),Multiline true,Name textBox2,Size new Size(181, 153),TabIndex 3};// // button1// button1 new Button{Location new Point(259, 48),Name button1,Size new Size(75, 23),TabIndex 4,Text 拆分1,UseVisualStyleBackColor true};button1.Click Button1_Click;// // button2// button2 new Button{Location new Point(259, 74),Name button2,Size new Size(75, 23),TabIndex 5,Text 拆分2,UseVisualStyleBackColor true};button2.Click Button2_Click;// // groupBox1// groupBox1 new GroupBox{Location new Point(12, 12),Name groupBox1,Size new Size(340, 207),TabIndex 0,TabStop false,Text 拆分字符串};groupBox1.Controls.Add(button2);groupBox1.Controls.Add(button1);groupBox1.Controls.Add(textBox2);groupBox1.Controls.Add(textBox1);groupBox1.Controls.Add(label2);groupBox1.Controls.Add(label1);groupBox1.SuspendLayout();// // Form1// AutoScaleDimensions new SizeF(7F, 17F);AutoScaleMode AutoScaleMode.Font;ClientSize new Size(364, 231);Controls.Add(groupBox1);Name Form1;StartPosition FormStartPosition.CenterScreen;Text 使用正则表达式拆分字符串;groupBox1.ResumeLayout(false);groupBox1.PerformLayout();}/// summary/// 拆分1:使用正则表达式根据数字进行拆分/// 遍历拆分后的字符串集合/// /summaryprivate void Button1_Click(object? sender, EventArgs e){if (textBox1!.Text ! ){textBox2!.Text ;string[] str MyRegex().Split(textBox1!.Text);foreach (string s in str){textBox2!.Text s Environment.NewLine;}}else{MessageBox.Show(源字符串不能为空, 拆分1);}}/// summary/// 拆分2/// /summaryprivate void Button2_Click(object? sender, EventArgs e){if(textBox1!.Text ! ){textBox2!.Text ;string s textBox1!.Text;char[] separators [1, 2, 3, 4, 5, 6, 7, 8, 9];string[] subs s.Split(separators/*, StringSplitOptions.RemoveEmptyEntries*/);//注释后与正则方法输出相同结果foreach (var sub in subs){textBox2!.Text sub Environment.NewLine;}}else{MessageBox.Show(源字符串不能为空, 拆分2);}}[GeneratedRegex([1-9])]private static partial Regex MyRegex();} }2.生成效果
http://www.pierceye.com/news/57445/

相关文章:

  • 南宁建设网站哪里好接外包项目
  • 国外免费网站空间字体设计免费版在线立即生成
  • 上海网站建设的网网站后台管理系统模板 html
  • 毕业设计网站建设体会软件 行业门户网站
  • 手机h5免费模板网站模板下载2023年国家免费技能培训
  • 南城县建设局网站求个网站你会感谢我的
  • 南阳网站改版wordpress漂亮的主题
  • paypal外贸门户网站二 建设电子商务网站的必要性
  • wordpress屏蔽字体做网站优化有什么作用
  • 用vue做网站的实例网络品牌营销的基础是
  • python官方网站在网站怎么做代销
  • 自己如何做网站统计中信建设有限责任公司最新新闻
  • 网站建设与管理专业好找工作吗建设部勘察设计网站
  • 淘宝客网站开发视频教程电商运营方案计划书
  • 国外网站如何做推广深圳seo优化外包
  • 红色文化网站建设北大荒建设集团有限公司网站
  • 免费行情软件app网站mnw下载wordpress图片清晰度
  • 聚美优品的网站建设状况单页面网站做百度推广
  • 小程序网站开发机构wordpress能做成app吗
  • 做美食的网站大庆做网站的公司
  • 免费推广产品的网站平台规划方案怎么写
  • 新锐媒体网站建设方案做的最好的视频教学网站
  • 做网站销售经常遇到的问题免费网页游戏平台
  • 网站备案有时间吗网络与智能媒体设计 干什么?
  • 网站镜像 动态苏州网架公司
  • 英文网站建设980深圳网站建设外贸公司排名
  • 软件dw做网站自学网站建设多久
  • 怎样做境外网站蜀山传奇网页游戏
  • 专业的上海网站建设公司哪家好最新新闻热点事件简短
  • 快速开租建站想学设计师首先要学什么