string字符串库中的string.cmpMatch()函数可以忽略大小写比较两个字符串,演示如下:
import win.ui;
/*DSG{{*/
var winform = win.form(text="简码编程 jianma123.com";right=311;bottom=215)
winform.add(
button={cls="button";text="忽略大小写比较";left=56;top=112;right=256;bottom=144;z=2};
button2={cls="button";text="区分大小写比较";left=56;top=152;right=256;bottom=184;z=4};
edit={cls="edit";text="abcdefg";left=16;top=16;right=296;bottom=48;edge=1;multiline=1;z=1};
edit2={cls="edit";text="ABCDEFG";left=16;top=56;right=296;bottom=88;edge=1;multiline=1;z=3}
)
/*}}*/
winform.button.oncommand = function(id,event){
var str1 = winform.edit.text;
var str2 = winform.edit2.text;
if(string.cmpMatch(str1,str2)){
winform.msgbox("相同")
}else {
winform.msgbox("不相同")
}
}
winform.button2.oncommand = function(id,event){
var str1 = winform.edit.text;
var str2 = winform.edit2.text;
if(str1==str2){
winform.msgbox("相同")
}else {
winform.msgbox("不相同")
}
}
winform.show()
win.loopMessage();