您的位置:首页 > 产品设计 > UI/UE

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

2016-12-07 08:30 726 查看
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正确使用方法,哪位大神如果知道,烦请告知一下。
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
相关文章推荐