A simple split string of a simple split string (with Zaoyang)

xiaoxiao2021-03-06  68

Using system; using system.collections;

A summary description of Namespace consoleApplication4 {///

/// class1. /// class class1 {/// /// The primary entry point of the application. /// [stiveread] static void main (string [] args) {// // Todo: Add code here to start the application // string aa = "a,; b,; DDD; E F; yy "; string [] bb = splitstring (aa," ,; "); for (int i = 0; i // / / sumper according to the specified tag, and return the character number /// /// To separate characters /// Separate marker /// static string [] splitstring (string SourceString, string splitchar) {int Len = splitchar. Length; arraylist al = new arraylist (); int startPOS = 0; // Start position int J = -1; // Match index position while (true) {j = sourceString.indexof (splitchar, startpos); if (j> -1) {Al.Add (SourceString.Substring (StartPos, J-StartPOS); StartPOS = J LEN;} else {al.add (SourceString.Substring (StartPOS)); Break;}} string [] Result IF (al.count == 0) {string [] r = new string [1]; r [0] = SourceString; Result = R; } Else {string [] r = new string [al.count]; for (int i = 0; i
转载请注明原文地址:https://www.9cbs.com/read-110409.html

New Post(0)