Timeline for String manipulation in Java
Current License: CC BY-SA 3.0
12 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 14, 2013 at 10:29 | comment | added | Joe F | +1 I like this better now. My solutions also had order dependent deletion, which I didn't really like. Nice work! | |
May 14, 2013 at 8:15 | history | edited | BenderBoy | CC BY-SA 3.0 |
added 188 characters in body
|
May 14, 2013 at 8:11 | comment | added | BenderBoy |
Thanks! Edited. I had actually used chars and charAt first, but since you can't have empty chars, I switched. You're right, chars do fine for the comparison.
|
|
May 14, 2013 at 8:06 | history | edited | BenderBoy | CC BY-SA 3.0 |
deleted 30 characters in body
|
May 14, 2013 at 7:27 | comment | added | abuzittin gillifirca |
+1 for closely matching the description, conciseness and robustness (w.r.t. @bowmore's order dependent deletion). In addition to @SoftwareMonkey's charAt critique: Ternary operators are OK, But use parentheses and spaces around operators to improve readability of expressions. Also you should declare variables where they are assigned, this is not C or javascript. Use English names whenever international readers may possibly see the code (that is always on codereview).
|
|
May 14, 2013 at 6:40 | comment | added | L. Cornelius Dol |
Why create substrings for single character equality tests, rather than, e.g, str.charAt(0)=='a' ?
|
|
May 14, 2013 at 6:05 | history | edited | BenderBoy | CC BY-SA 3.0 |
added 65 characters in body
|
May 14, 2013 at 6:05 | comment | added | BenderBoy | True. I only tested strings of length 2. Fixed my code above. Sorry for all the ternary crap, but I find a bunch of ifs would needlessly clutter this simple function. | |
May 13, 2013 at 16:54 | comment | added | Joe F |
This throws a StringIndexOutOfBoundsException for strings of length 0 and 1.
|
|
S May 13, 2013 at 14:33 | review | Low quality posts | |||
May 13, 2013 at 14:49 | |||||
S May 13, 2013 at 14:33 | review | First posts | |||
May 13, 2013 at 15:19 | |||||
May 13, 2013 at 14:15 | history | answered | BenderBoy | CC BY-SA 3.0 |