有关C#代码的问题 [英] Qoestions about C# code

查看:109
本文介绍了有关C#代码的问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

PLZ我现在想要了解c#

plz i want to now how comper between two sting on c#

推荐答案

之间的两个问题。你应该买一本C#书或阅读一些在线教程。你不能通过论坛帖子在这个级别学习C#。



这取决于你想要比较的内容。如果你想比较它们是否相同,那么==运算符就会这样做



if(string1 == string2)



如果你想做一个不区分大小写的比较,那么让它们都是小写的:



if(string1.ToLower()= = string2.ToLower())



还有很多其他比较字符串的方法(例如Contains),但实际上,在这个级别,你需要如果你想学习C#,你可以通过一本书来学习。
You should buy a C# book or read some online tutorials. You can''t learn C# at this level via forum posts.

It depends what you want to compare. If you want to compare if they are both the same, then the == operator will do it

if (string1 == string2)

If you want to do a case insensitive compare, then make them both lower case:

if (string1.ToLower() == string2.ToLower())

There''s many other ways to compare strings ( such as Contains ), but really, again, at this level, you need to work through a book if you want to learn C#.


这篇关于有关C#代码的问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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