Hi everyone!
I am having troubles making the second IF statment execute in my code:
Pattern dl_noise_rates_p = Pattern.compile("\\d+\\s(.+)\\s(.+)\\s(.+)\\s(.+)");
Matcher dl_noise_rates_m = dl_noise_rates_p.matcher(lineString2);
if(dl_noise_rates_m.find()){
String s_dl_nr1 = (dl_noise_rates_m.group(1));
//checking for non numbers pulled in the regex
if(s_dl_nr1 == "NaN"){ //| s_dl_nr1 == "NaN" | s_dl_nr1 == " NaN"
System.out.println ("OMGOMGOMGOMGOMGOMGOMGOMGOMG ITS NOT A DECIMAL NUMBER");
s_dl_nr1 = "0";
}
System.out.println ("Download noise rate value 1: " + s_dl_nr1);
}
I am pretty sure the "OMGOMG" section should be getting outputted becasue when I execute my script I get this. Since I am seeing that the value of my string s_dl_nr1 is "NaN" I really don't understand why the 2nd IF statement is not executing.
Download noise rate value 1: NaN
My regular expression is grabbing 4 numbers or NaN(s), storing them in variables (I didn't show all the code since its repetitive). I am trying to turn the NaN(s) string into "0" so I can convert it into a double like the rest of my values and then run some computations. Does anyone have any ideas what my issue could potentially be, or perhaps some type of work around? I really appreciate all help, ideas, comments, suggestions, etc.