Unlock a world of possibilities! Login now and discover the exclusive benefits awaiting you.
I'm trying to write a case statement in tjavarow using if then else. This is what I've written and it's not working.
output_row.Value = if (input_row.Value = "MP\/MM") {
output_row.Value = "MP / MM";
} else if (input_row.Value = "T \u200 MM") {
output_row.Value = "T - M";
} else if (input_row.Value = "T \u200 ND") {
output_row.Value = "T - ND";
} else if (input_row.Value = "T LF") {
output_row.Value = "LF";
} else {
output_row.Value = input_row.Value;
}
I suspect that is caused by this "MP\/MM". Change it to "MP\\/MM" and that will work. "\" is known as an escape character in Java. Certain characters have alternative meanings/uses in Strings. For example, a " character is used to enclose a String, if used inside the String without an escape character, it breaks the String. The "\" character is the escape character, so to use it literally you need to escape it.
After making the change per below suggestion. Now, I'm getting following error message.
Detail Message: Invalid escape sequence (valid ones are \b \t \n \f \r \" \' \\ )
I suspect that is caused by this "MP\/MM". Change it to "MP\\/MM" and that will work. "\" is known as an escape character in Java. Certain characters have alternative meanings/uses in Strings. For example, a " character is used to enclose a String, if used inside the String without an escape character, it breaks the String. The "\" character is the escape character, so to use it literally you need to escape it.
Resolved it by adding \ front of the escape character