uiautomator在UTF-8的编码方式下如何匹配英文和中文包括汉字

来源:互联网 发布:mindmanager mac 10.6 编辑:程序博客网 时间:2024/05/09 06:26

                UiObject aa = new UiObject(new UiSelector().descriptionStartsWith("练与测"));
System.out.println("practice---"+aa.exists());
        UiObject a = new UiObject(new UiSelector().descriptionMatches("^(\u0041)*[\u4e00-\u9fa5]+"));
        System.out.println("A---"+a.exists());
UiObject b = new UiObject(new UiSelector().descriptionMatches("^(\u0042)*[\u4e00-\u9fa5]+"));
System.out.println("B---"+b.exists());
UiObject c = new UiObject(new UiSelector().descriptionMatches("^(\u0042)*[\u4e00-\u9fa5]+"));
System.out.println("C---"+c.exists());
UiObject d = new UiObject(new UiSelector().descriptionMatches("^(\u0041)*[\u4e00-\u9fa5]+"));
System.out.println("D---"+d.exists());
if(a.exists() || b.exists() || c.exists() || d.exists()){
System.out.println("this is choose");
}else{
System.out.println("this is write");
}

以上ABCD,就是判断标准,暂时没有发现startwith正确使用方法,哪位大神如果知道,烦请告知一下。

0 0
原创粉丝点击