0

Shorten the code

This is my solution to "convert us date to eu date" problem from code coach. I would appreciate any suggestions as to how to shorten the code. Thanks in advance! https://code.sololearn.com/cL4y2Q3pc60Z/?ref=app

6th Jan 2020, 11:55 AM
Vitaliy Reshetar
Vitaliy Reshetar - avatar
3 Respostas
+ 1
Use split method. If str.char(0) is a number then just split by / And swap 0 and 1 Else split by space, find string equalent by array or switch cases. And split 2nd element by comma, remove spaces. I did it in this way... Took 20 lines code only....
6th Jan 2020, 1:13 PM
Jayakrishna 🇮🇳
+ 1
Vitaliy Reshetar wel come...
6th Jan 2020, 1:23 PM
Jayakrishna 🇮🇳
0
Jayakrishna, thank you! It was very helpful!
6th Jan 2020, 1:19 PM
Vitaliy Reshetar
Vitaliy Reshetar - avatar