它是先得的,但首先要记住的是,这在方括号内抽取案文,这样你就能够做到。
textVariable = a,b,c,x:y,d,e,f,p:q
然后将各栏分为几栏,这样你就有一个阵列,每个要素都是座标的一部分。 因此,你所形成的阵列将是
array[0] = a
...
array[3] = x:y
...
然后穿过你们的阵列,创造你们想要的最终扼杀。 类似情况(尽管是经过检测的)
finalString = ""
tempString = ""
for (int i = 0, i < array.length; i++) {
if (array[i].contains(":")) { // then it needs to be between the two values
if (finalString.length > 0) {
finalString = finalString + " or "; // need to add an or
}
if (tempString.length > 0) { // then need to add the keyword in (...) to finalString
finalString = finalString + tempString + ") or ";
}
temparray = array[i].split(":")
finalString = finalString + " keyword between " + temparray[0] + " and " + temparray[1]
} else {
if (tempString.length = 0) {
tempString= "keyword in ("; // need to start the next set
} else {
tempString = tempString + ", "
}
tempString = tempString + array[i];
}
}