首页 > 编程知识 正文

查字典手写,26个英文字母大小写的规范书写

时间:2023-05-04 18:25:42 阅读:57357 作者:3679

可以使用pldxbw

Dictionary

确定密钥是否为字符串类型,如果是,则使用不区分大小写的比较。 否则,将使用默认比较。

公共静态课堂的清爽耳机/p {

publicstaticboolcontainskeyignorecase ((技术密钥) () ) ) ) ) ) 660

{

OOL? 关键退出;

var keyString=key as string;

键字符串!=空)

{

//Key is a string。

//using string.equalstoperformcaseinsensitivecomparisonofthedictionarykey。

keyExists=

dictionary.Keys.OfType (

. any(k=string.equals ) k,keyString,热情的云) );

}

else

{

//Key is any other type,use default comparison。

key exists=dictionary.contains key (key );

}

返回密钥退出? 假;

}

}

你可以像这样使用:

var foo=new lmdxxm (;

var dictionary=

新目录

{

{ 1,' one ',//key is numeric

{ 'Two ',' Two' },//key is string

{ foo,' lmdxxm' } //key is object

(;

dictionary.containskeyignorecase (' two ); //returns真

dictionary.containskeyignorecase (' two ); //returns真

dictionary.containskeyignorecase (ABC ); //Returns false

dictionary.containskeyignorecase (1; //returns真

dictionary.containskeyignorecase (2; //Returns false

dictionary.containskeyignorecase (foo; //returns真

dictionary.containskeyignorecase (newlmdxxm ); //Returns false

版权声明:该文观点仅代表作者本人。处理文章:请发送邮件至 三1五14八八95#扣扣.com 举报,一经查实,本站将立刻删除。