SoFunction
Updated on 2025-03-01

Detailed explanation of the usage in C#

The first method

string s=abcdeabcdeabcde;
string[] sArray=('c') ;
foreach(string i in sArray)
(());

Output the following results:

ab

deab

deab

de

The second method

We see that the result is a segmentation with a specified character. Use another constructor to match multiple words

Characters are split:

string s="abcdeabcdeabcde";
string[] sArray1=(new char[3]{'c','d','e'}) ;
foreach(string i in sArray1)
(());

The following results can be output

ab

ab

ab

The above is a detailed explanation of the usage of C# introduced by the editor. I hope it will be helpful to everyone. If you have any questions, please leave me a message. The editor will reply to everyone in time!