mirror of
https://github.com/InsanusMokrassar/MicroUtils.git
synced 2025-09-03 15:19:44 +00:00
MPPFile#withoutSlashAtTheEnd
This commit is contained in:
@@ -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
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user