Merge pull request 'Fix is valid pinyin method' (#2) from fix into main
All checks were successful
Publish package / publish (push) Successful in 1m32s
All checks were successful
Publish package / publish (push) Successful in 1m32s
Reviewed-on: #2
This commit is contained in:
commit
b58af68178
@ -5,7 +5,7 @@ plugins {
|
|||||||
}
|
}
|
||||||
|
|
||||||
group = "com.marvinelsen"
|
group = "com.marvinelsen"
|
||||||
version = "1.0-SNAPSHOT"
|
version = "1.1-SNAPSHOT"
|
||||||
|
|
||||||
repositories {
|
repositories {
|
||||||
mavenCentral()
|
mavenCentral()
|
||||||
|
@ -15,7 +15,9 @@ data class Syllable(
|
|||||||
private val zhuyinToneMarkRegex = """[ˊˇˋ˙]""".toRegex()
|
private val zhuyinToneMarkRegex = """[ˊˇˋ˙]""".toRegex()
|
||||||
|
|
||||||
fun isValidPinyinWithToneNumberSyllable(pinyinSyllable: String) =
|
fun isValidPinyinWithToneNumberSyllable(pinyinSyllable: String) =
|
||||||
pinyinSyllable.last().isDigit() && pinyinSyllable.last().digitToInt() in 1..5 && pinyinSyllable.lowercase() in pinyinToZhuyin
|
pinyinSyllable.last().isDigit() && pinyinSyllable.last().digitToInt() in 1..5 && pinyinSyllable
|
||||||
|
.substring(0, pinyinSyllable.lastIndex)
|
||||||
|
.lowercase() in pinyinToZhuyin
|
||||||
|
|
||||||
fun fromPinyinWithToneNumber(pinyinWithToneNumber: String): Syllable {
|
fun fromPinyinWithToneNumber(pinyinWithToneNumber: String): Syllable {
|
||||||
val pinyinWithoutNumber = pinyinWithToneNumber.substring(0, pinyinWithToneNumber.lastIndex)
|
val pinyinWithoutNumber = pinyinWithToneNumber.substring(0, pinyinWithToneNumber.lastIndex)
|
||||||
|
Loading…
Reference in New Issue
Block a user