if(word_a!= word_b)然后...... [英] if(word_a != word_b) then ...
本文介绍了if(word_a!= word_b)然后......的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
if(word_a!= word_b)then .... this(即比较
字符串)似乎不允许在C#中使用 - 或者是否有
a方式?
请回复,
谢谢,
Adrian。
if(word_a != word_b) then .... this (i.e., comparing
strings) doesn''t seem to be allowed in C# - or is there
a way?
Please respond,
thank you,
Adrian.
推荐答案
我不确定我是否理解你的问题。但这对我有用:
string s1 =" Hello" ;;
string s2 =" Hello";
Console.WriteLine(字符串是否不同?{0},
(s1!= s2)?" Yes!":No!;;
亲切的问候,
matthias
-
我喜欢最后期限。我喜欢他们飞过时发出的嘶嘶声。
[道格拉斯亚当斯]
Adrian写道:
I''m not sure if I understood your question. But this works for me:
string s1 = "Hello";
string s2 = "Hello";
Console.WriteLine("Are strings different? {0}",
(s1 != s2) ? "Yes!" : "No!");
kind regards,
matthias
--
I love deadlines. I like the whooshing sound they make as they fly by.
[Douglas Adams]
Adrian wrote:
if(word_a != word_b)然后....这个(即比较
字符串)在C#中似乎不被允许 - 或者是否有某种方式?
请回复,
谢谢你,
Adrian。
if(word_a != word_b) then .... this (i.e., comparing
strings) doesn''t seem to be allowed in C# - or is there
a way?
Please respond,
thank you,
Adrian.
它确实有效,
发布一个示例,说明您的问题以及
字符串的确切内容
也许你有不同的情况,请这样做:
if(word_a.ToLower()!= word_b.ToLower())
欢呼,
-
Ignacio Machin,
ignacio.machin at dot.state.fl.us
Florida Department of Transportation
Adrian < aa@aa.aa>在消息中写道
news:75 *************************** @ freeler.nl ...
Hi,
It does work of course,
Post an example with your problem and with the EXACT contents of the
strings
maybe you have them with different cases, do this:
if( word_a.ToLower() != word_b.ToLower() )
cheers,
--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation
"Adrian" <aa@aa.aa> wrote in message
news:75***************************@freeler.nl...
if(word_a!= word_b)然后....这个(即比较
字符串)似乎在C#中似乎不被允许 - 或者是否有某种方式?
请回复,
谢谢你,阿德里安。
if(word_a != word_b) then .... this (i.e., comparing
strings) doesn''t seem to be allowed in C# - or is there
a way?
Please respond,
thank you,
Adrian.
>
Ignacio Machin(.NET / C#MVP)" < ignacio.machin AT dot.state.fl.us>在消息新闻中写了
:%2 **************** @ TK2MSFTNGP14.phx.gbl ...
"Ignacio Machin ( .NET/ C# MVP )" <ignacio.machin AT dot.state.fl.us> wrote
in message news:%2****************@TK2MSFTNGP14.phx.gbl...
它当然可以工作,
用你的问题和
字符串的精确内容发布一个例子
Hi,
It does work of course,
Post an example with your problem and with the EXACT contents of the
strings
private void Form1_Load(object sender,System.EventArgs e)
{
if(" monkey"< ;驴)
panel1.Text =猴子小于驴子;
其他
panel1.Text ="猴子不小于驴子;;
}
private void Form1_Load(object sender, System.EventArgs e)
{
if("monkey" < "donkey")
panel1.Text = "Monkey is smaller than donkey";
else
panel1.Text = "Monkey is not smaller than donkey";
}
这篇关于if(word_a!= word_b)然后......的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文