Skip to content

Instantly share code, notes, and snippets.

@saturngod
Created November 28, 2017 10:48
Show Gist options
  • Save saturngod/5836d9997398b6239d5b4f8dee9304b6 to your computer and use it in GitHub Desktop.
Save saturngod/5836d9997398b6239d5b4f8dee9304b6 to your computer and use it in GitHub Desktop.
English Number to Myanmar Number
/**
* 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