|
楼主 |
发表于 2013-10-7 19:43:25
|
显示全部楼层
本帖最后由 FFUR2007SLX2_5 于 2013-10-11 16:09 编辑
80楼,武装突袭3 - 字母大小写区分
正如上一篇数组篇中所提到的,武装突袭3是不区分大小写的,那么要是我有两个变量一定要区分大小写呢?也许我们第一个会想到的是==和!=,很抱歉,依旧不行,为啥?请看:- a = "HELLO";
- b = "hello";
- _result = if (a == b) then {"true"} else {"false"};
- //_result is "true"
- _result = if (a != b) then [{"true"},{"false"}];
- //result is "false"
复制代码 细心的朋友发现我们之前提到的in和find是区分大小写的,这里是要跳过的,不过顺便介绍一下if () then {} else {}还有一种写法,请看:- a = "HELLO";
- b = "hello";
- _result = if !(a in [b]) then [{"true"},{"false"}];
- //result is "true"
- _result = if (([b] find a) < 0) then [{"true"},{"false"}];
- //result is "true"
复制代码 我们还有两个方法也可以区分大小写,一个是switch/case,请看:- a = "HELLO";
- b = "hello";
- _result = switch a do {case b : {"true"}; default {"false"}};
- //_result is "false"
- b = "HELLO";
- _result = switch a do {case b : {"true"}; default {"false"}};
- //_result is "true"
复制代码 还有一个是toUpper 和 toLower,这很简单,这里不说了。下面一讲中我们将来到武装突袭3之循环篇。
请切换至99楼,武装突袭3之循环全解析(一)(二)(三) |
本帖子中包含更多资源
您需要 登录 才可以下载或查看,没有账号?加入VME
x
|