mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2024-12-22 00:27:15 +00:00
MPPFile#withoutSlashAtTheEnd
This commit is contained in:
parent
d50dffec8c
commit
925702d315
@ -4,6 +4,8 @@
|
||||
|
||||
* `Versions`:
|
||||
* `UUID`: `0.3.0` -> `0.3.1`
|
||||
* `Common`:
|
||||
* New property `MPPFile#withoutSlashAtTheEnd`
|
||||
|
||||
## 0.5.24
|
||||
|
||||
|
@ -7,7 +7,7 @@ import kotlin.jvm.JvmInline
|
||||
@JvmInline
|
||||
value class FileName(val string: String) {
|
||||
val name: String
|
||||
get() = string.takeLastWhile { it != '/' }
|
||||
get() = withoutSlashAtTheEnd.takeLastWhile { it != '/' }
|
||||
val extension: String
|
||||
get() = name.takeLastWhile { it != '.' }
|
||||
val nameWithoutExtension: String
|
||||
@ -17,6 +17,8 @@ value class FileName(val string: String) {
|
||||
filename.substring(0, it)
|
||||
} ?: filename
|
||||
}
|
||||
val withoutSlashAtTheEnd: String
|
||||
get() = string.dropLastWhile { it == '/' }
|
||||
override fun toString(): String = string
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user