str#在c#? [英] strcat in c#?
问题描述
你好
假设我有两个varibles,一个名称为var1,另一个是var2,
var1包含字符串C:\和var2保持游戏是否有命令将
组合在一起?
当我使用C ++时,我可以使用命令strcat(var1,var2);
是否有类似strcat的命令?在c#中?
Hello
Say i have two varibles one name var1 and the other var2,
var1 holds the string "C:\" and var2 holds "games" is there a command to
combian the two?
When i use C++ i could use the command strcat(var1, var2);
Is there a command like "strcat" in c#?
推荐答案
使用
var1 + var2
:)
它在字符串类中重载检出字符串类以获得更多
函数。
"复古" <再*** @ indovirus.net>在留言中写道
news:dg ******************* @ news.demon.co.uk ...
use
var1+var2
:)
its overloaded in the string class check out string class for more
functions.
"Retro" <re***@indovirus.net> wrote in message
news:dg*******************@news.demon.co.uk...
你好
说我有两个varibles一个名称var1和另一个var2,
var1保存字符串C:\和var2保持游戏是否有命令将两者组合在一起?
当我使用C ++时,我可以使用命令strcat(var1,var2);
是否有类似的命令" strcat的"在c#?
Hello
Say i have two varibles one name var1 and the other var2,
var1 holds the string "C:\" and var2 holds "games" is there a command to
combian the two?
When i use C++ i could use the command strcat(var1, var2);
Is there a command like "strcat" in c#?
Retro写道:
你好
说我有两个varibles一个名称var1和另一个var2,
var1包含字符串C:\和var2保持游戏是否有命令组合这两个?
当我使用C ++时我可以使用命令strcat(var1,var2);
当然,在C ++中你也可以使用标准的
库中的字符串类:
std :: string var1 =" C:\\" ;;
std :: string var2 =" games";
std :: string var3 = var1 + var2;
在C#中,System.String类的行为完全相同:
System.String var1 =" C:\\" ;;
System.String var2 =" games";
System.String var3 = var1 + var2 ;
是否有类似strcat的命令?在c#?
Hello
Say i have two varibles one name var1 and the other var2,
var1 holds the string "C:\" and var2 holds "games" is there a command
to combian the two?
When i use C++ i could use the command strcat(var1, var2);
Well, of course, in C++ you could also use the string class in the standard
library:
std::string var1 = "C:\\";
std::string var2 = "games";
std::string var3 = var1+var2;
In C# the System.String class behaves the exact same way:
System.String var1 = "C:\\";
System.String var2 = "games";
System.String var3 = var1 + var2;
Is there a command like "strcat" in c#?
现在,如果你真的想要在这个低级别控制它,
就有StringBuilder类同时它将允许您更直接地控制字符串缓冲区。
System.Text.StringBuilder sb1 = new System.Text.StringBuilder(" C:\\");
sb1.Append(var2);
这将产生非常接近的效果strcat的工作方式。
-
Reginald Blue
"我一直希望我的电脑是和我的
电话一样易于使用。我的愿望成真了。我不再知道如何使用我的
电话。
- Bjarne Stroustrup(C ++的创始人)[引自2003年
国际智能用户界面会议]
Now, if you really mean that you want to control it at this low a level,
there is the StringBuilder class as well which will allow you more direct
control of the string buffers.
System.Text.StringBuilder sb1 = new System.Text.StringBuilder("C:\\");
sb1.Append(var2);
This will have an effect which is very close to the way that strcat works.
--
Reginald Blue
"I have always wished that my computer would be as easy to use as my
telephone. My wish has come true. I no longer know how to use my
telephone."
- Bjarne Stroustrup (originator of C++) [quoted at the 2003
International Conference on Intelligent User Interfaces]
System.Text.StringBuilder更高效。喜欢......如...
string var1 = @" c:\" ;;
string var2 =" games";
System.Text.StringBuilder var3 = System.Text.StringBuilder();
var3.Append(var1);
var3.Append( var2);
" Raj Chudasama"写道:
System.Text.StringBuilder is more efficient. Somehing like...
string var1 = @"c:\";
string var2 = "games";
System.Text.StringBuilder var3 = System.Text.StringBuilder();
var3.Append(var1);
var3.Append(var2);
"Raj Chudasama" wrote:
使用
var1 + var2
它在字符串类中重载检出字符串类更多
功能。
复古 <再*** @ indovirus.net>在消息中写道
新闻:dg ******************* @ news.demon.co.uk ...
use
var1+var2
:)
its overloaded in the string class check out string class for more
functions.
"Retro" <re***@indovirus.net> wrote in message
news:dg*******************@news.demon.co.uk...
你好
说我有两个varibles一个名称var1和另一个var2,
var1保存字符串C:\和var2保持游戏是否有命令将两者组合在一起?
当我使用C ++时,我可以使用命令strcat(var1,var2);
是否有类似的命令" strcat的"在c#?
Hello
Say i have two varibles one name var1 and the other var2,
var1 holds the string "C:\" and var2 holds "games" is there a command to
combian the two?
When i use C++ i could use the command strcat(var1, var2);
Is there a command like "strcat" in c#?
这篇关于str#在c#?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!