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