下面代碼實現用“A”字符分割一個字符串成字符串數組,然後用”__”重新連接字符
例如輸入:HelloAworldAndYOU
輸出結果:Hello__world__ndYOU
static void Main(string[] args)
{
string str = Console.ReadLine();
string[] strArray = str.Split("A".ToCharArray());
string result = string.Join("__", strArray);
Console.WriteLine(result);
Console.ReadLine();
}