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.
Try
where
joinis a method that joins your string back from an array.