Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #39076
| Newsgroups | comp.lang.java.programmer |
|---|---|
| Date | 2019-08-07 11:47 -0700 |
| Message-ID | <868b9ba4-bc72-4ad4-8a13-a91bd1ae9c2e@googlegroups.com> (permalink) |
| Subject | Evaluation strings question? |
| From | cdalten@gmail.com |
Given a method like the following...
@TargetApi(24)
public void convertEndCivilianTimeToMilitaryTime(String endHour, String endMinute, String endAmOrPm) {
if (endAmOrPm.equals("PM") && !endHour.equals("12")) {
endMilitaryHour = Integer.parseInt(endHour) + 12;
endMilitaryMinute = Integer.parseInt(endMinute);
//setStartMilitaryHour(startMilitaryHour);
//setStartMilitaryMinute(Integer.parseInt(startMinute));
} else if (endAmOrPm.equals("AM") && endHour.equals("12")) {
endMilitaryHour = 24;
endMilitaryMinute = Integer.parseInt(endMinute);
}
else {
try {
endMilitaryHour = Integer.parseInt(endHour);
endMilitaryMinute = Integer.parseInt(endMinute);
} catch (Exception e) {
Log.e("LG_WORK_PHONE", "BLANK: " + e);
}
}
}
This part..
if (endAmOrPm.equals("PM") && !endHour.equals("12")) {
}
evaluates TRUE when I run the program program but evaluates FALSE when I test it on my IDE evaluate code screen. Can someone point me in the right direction as to why the strings display this kind of behavior? Because I have no clue why it does what it does.
Back to comp.lang.java.programmer | Previous | Next — Next in thread | Find similar | Unroll thread
Evaluation strings question? cdalten@gmail.com - 2019-08-07 11:47 -0700
Re: Evaluation strings question? Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-08-07 15:10 -0400
Re: Evaluation strings question? cdalten@gmail.com - 2019-08-07 12:28 -0700
Re: Evaluation strings question? Eric Sosman <esosman@comcast-dot-net.invalid> - 2019-08-07 15:32 -0400
Re: Evaluation strings question? Daniele Futtorovic <da.futt.news@laposte-dot-net.invalid> - 2019-08-07 22:05 +0200
Re: Evaluation strings question? cdalten@gmail.com - 2019-08-07 13:47 -0700
Re: Evaluation strings question? Eric Douglas <e.d.programmer@gmail.com> - 2019-08-08 05:03 -0700
csiph-web