Last active
March 7, 2019 02:47
-
-
Save ishideo/066820598cc0489617372a2be1eb2e91 to your computer and use it in GitHub Desktop.
This file contains hidden or 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
/* | |
* This Kotlin source file was generated by the Gradle 'init' task. | |
*/ | |
package KatakanaRomajiConvert | |
import com.ibm.icu.text.Transliterator | |
class KatakanaRomajiConvert(val word: String = "") { | |
val katakanaToRomaji: String | |
get(): String { | |
val transliterator = Transliterator.getInstance("Katakana-Latin") | |
return transliterator.transliterate(word) | |
} | |
} | |
fun main(args: Array<String>) { | |
if (args.size != 0) { | |
val t = KatakanaRomajiConvert(args[0]) | |
println(t.katakanaToRomaji) | |
} else { | |
println("") | |
} | |
} |
This file contains hidden or 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
/* | |
* This Kotlin source file was generated by the Gradle 'init' task. | |
*/ | |
package KatakanaRomajiConvert | |
import kotlin.test.Test | |
import kotlin.test.assertEquals | |
class AppTest { | |
@Test fun testAppHasAKatakanaArg() { | |
val t = KatakanaRomajiConvert("トウキョウ") | |
assertEquals("toukyou", t.katakanaToRomaji) | |
} | |
@Test fun testAppHasNoArg() { | |
val t = KatakanaRomajiConvert() | |
assertEquals("", t.katakanaToRomaji) | |
} | |
@Test fun testAppHasEmptyArg() { | |
val t = KatakanaRomajiConvert("") | |
assertEquals("", t.katakanaToRomaji) | |
} | |
@Test fun testAppHasMixCharStrArg() { | |
val t = KatakanaRomajiConvert("あいうアイウabcABC") | |
assertEquals("あいうaiuabcABC", t.katakanaToRomaji) | |
} | |
@Test fun testAppHasMixCharAndSpcStrArg() { | |
val t = KatakanaRomajiConvert("あいう アイウ abc ABC") | |
assertEquals("あいう aiu abc ABC", t.katakanaToRomaji) | |
} | |
} |
This file contains hidden or 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
/* | |
* This file was generated by the Gradle 'init' task. | |
* | |
* This generated file contains a sample Kotlin application project to get you started. | |
*/ | |
import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar | |
plugins { | |
// Apply the Kotlin JVM plugin to add support for Kotlin on the JVM | |
kotlin("jvm") version "1.3.10" | |
// Apply the application to add support for building a CLI application | |
id("application") | |
id("com.github.johnrengelman.shadow") version "5.0.0" | |
} | |
repositories { | |
// Use jcenter for resolving your dependencies. | |
// You can declare any Maven/Ivy/file repository here. | |
jcenter() | |
} | |
dependencies { | |
// Use the Kotlin JDK 8 standard library | |
implementation("org.jetbrains.kotlin:kotlin-stdlib-jdk8") | |
// Use the Kotlin icu4j library | |
implementation("com.ibm.icu:icu4j:63.1") | |
// Use the Kotlin test library | |
testImplementation("org.jetbrains.kotlin:kotlin-test") | |
// Use the Kotlin JUnit integration | |
testImplementation("org.jetbrains.kotlin:kotlin-test-junit") | |
} | |
application { | |
// Define the main class for the application | |
mainClassName = "KatakanaRomajiConvert.AppKt" | |
} | |
tasks.withType<Jar> { | |
manifest { | |
attributes(mapOf( | |
"Main-Class" to "KatakanaRomajiConvert.AppKt" | |
)) | |
} | |
} | |
tasks.withType<ShadowJar> { | |
baseName = "kana2romaji" | |
classifier = "" | |
version = "" | |
} |
This file contains hidden or 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
org.gradle.jvmargs='-Dfile.encoding=UTF-8' | |
org.gradle.daemon=true | |
// org.gradle.java.home=C:\\JDKPortable | |
// systemProp.http.proxyHost= | |
// systemProp.http.proxyPort= | |
// systemProp.https.proxyHost= | |
// systemProp.https.proxyPort= |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment