Created
November 28, 2017 10:48
-
-
Save saturngod/5836d9997398b6239d5b4f8dee9304b6 to your computer and use it in GitHub Desktop.
English Number to Myanmar Number
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by saturngod on 28/11/17. | |
*/ | |
fun main(args:Array<String>) { | |
var k = "49085678237896" | |
print(getMMNumber(k)) | |
} | |
fun getMMNumber(eng: String): String { | |
try { | |
eng.toDouble() | |
//it's digit | |
var mm = "" | |
eng.toCharArray().map { char -> char.toInt() + 4112 }.forEach { no -> mm = mm + no.toChar() } | |
return mm | |
}catch(e: NumberFormatException) { | |
return eng | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment