[英]Selenium Webdriver(Java) - crop string value from array
I have an array with values as: 我有一个数组的值为:
(C:), (D:), (E:) - I need to crop any of this value to get - C , D or E (C:),(D:),(E :) -我需要裁剪任何此值以获得-C,D或E
The array is : 数组是:
WebElement table = new WebDriverWait(Login.driver, 30).until(ExpectedConditions.visibilityOfElementLocated
(By.id("table1")));
List<WebElement> rows = table.findElements(By.id("td1"));
java.util.Iterator<WebElement> i = rows.iterator();
while(i.hasNext()) {
WebElement row = i.next();
cont = row.getText();
System.out.println("Test1: "+cont);
}
I have tried to use 我尝试使用
String[] v_split = cont.split(" ");
String v_splCmpIc = v_split[0];
But this shown an array index. 但这显示了数组索引。
Is there any chance to crop an index as I showed above? 如上所示,是否有机会裁剪索引?
解决方案将是:
cont = row.getText().replace("(","").replace(")","").replace(":",""); // inside while
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.