Please find my example code below:
String[] tempCrfFC = crfFC; //crfFC is a String[] itself
for(int i = 0; i < crfFC.length; i++) {
String[] crfTok = tempCrfFC[i].split("\\s");
if(crfTok.length == 40) {
if(crfTok[39].split("/")[0].equals("O")) {
Double v = Double.parseDouble(crfTok[39].split("/")[1]);
if (v <= d && (i == 0 || prevTagged != i-1)) {
tempCrfFC[i].split("\\s")[39] = "A"; //<-------
System.out.println("val: "+tempCrfFC[i].split("\\s")[39]);
System.out.println("tempCrfFC: "+tempCrfFC[i]);
prevTagged = i;
}
}
}
}
Example of a tempCrfFC line:
The T Th The null e he The null Aaa Aa 1 1 1 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 O B O B O 0 DT O O/0.892667
At the line marked with "<-----" I wish to reassign the existing value to a new value "A". However, on printing the output, the observation is that the value at that index (39) remains unchanged. Could someone help me resolve this?
Thank you.
tempCrfFC[i] = tempCrfFC[i].substring(0,38) + "A" + tempCrfFC[i].substring(40,tempCrfFC[i].length())vtocurrentValue. Renamedto whatever it actually stands for.crfFCandcrfTokmeans nothing to anyone who isn't you. You aren't limited to 5 character, so make variable names meaningful.