Joanne
sai rama krishna wrote:
I found below link and code
http://www.wikihow.com/Manipulate-Strings-in-Java
sai rama krishna wrote:Which is reducing number of lines of code and seems more simple.
Joanne
sai rama krishna wrote:Remove second if (line 6) and then use else instead as above?
Please advise
Joanne
Campbell Ritchie wrote:You will of course have problems if you pass a 0‑length String as an argument.
Joanne
Campbell Ritchie wrote:If you miss out the if-else and try substring(1) no an empty String, you will suffer an Exception.
Joanne
sai rama krishna wrote:But seeing two return statements in a method one inside if loop and other outside the if loop as last line of the method looks bit odd to me
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Joe Harry wrote:I could not resist posting a Scala version!
There are three kinds of actuaries: those who can count, and those who can't.
sai rama krishna wrote:I am trying to swap given string first and last character.
If I pass world i should get 'dorlw'
"Leadership is nature's way of removing morons from the productive flow" - Dogbert
Articles by Winston can be found here
Campbell Ritchie wrote:Agree the Martin Fowler version is easier to read than that above.
Campbell Ritchie wrote:Shall we get back to swapping ends of Strings?
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Build a man a fire, and he'll be warm for a day. Set a man on fire, and he'll be warm for the rest of his life.
Piet Souris wrote:
And what is wrong with: val result = word.last +: word.tail.init :+ word.head?
SCJP 1.4, SCWCD 1.4 - Hints for you, Certified Scrum Master
Did a rm -R / to find out that I lost my entire Linux installation!
Don't get me started about those stupid light bulbs. |