如何结合字符串与其他字符串... [英] how to combine to string with some other strings...

查看:51
本文介绍了如何结合字符串与其他字符串...的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有

一个

两个

三个

但我想要一两个或三个如何make?

in c#

i have
one
two
three
but i want one or two or three how its make?
in c#

推荐答案

尝试:
string s1 = "One";
string s2 = "Two";
string s3 = "Three";
string combined = string.Format("{0} or {1} or {2}", s1, s2, s3);



Or

string s1 = "One";
string s2 = "Two";
string s3 = "Three";
string combined = s1 + " or " + s2 + " or " + s3;

但是这个是不好的做法。

But this is not good practice.


string two = "two";
string str = "one " + two + " three";
System.Console.WriteLine(str);


这篇关于如何结合字符串与其他字符串...的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆