C# 程序以字符串形式连接单词
声明一个字符串并添加元素 −
string[] str = { "One", "Two", "Three", "Four", "Five" };使用 Join() 方法连接单词 −
string res = string.Join(" ", str);让我们来看看完整的代码 −
示例
using System;
public class Demo {
public static void Main() {
string[] str = { "One", "Two", "Three", "Four", "Five" };
// join words
string res = string.Join(" ", str);
Console.WriteLine(res);
}
}输出
One Two Three Four Five
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C 编程
C++
C#
MongoDB
MySQL
JavaScript
PHP