summaryrefslogtreecommitdiff
path: root/app/src/main/java/org/the_jk/cleversync/StringUtils.kt
diff options
context:
space:
mode:
authorJoel Klinghed <the_jk@spawned.biz>2024-07-15 23:52:28 +0200
committerJoel Klinghed <the_jk@spawned.biz>2024-07-16 00:25:07 +0200
commit42564c71cfb70c28831c662a3b6bf4084e079353 (patch)
tree111456fd3e8dce884d0380a81d70950062c7d212 /app/src/main/java/org/the_jk/cleversync/StringUtils.kt
parent4a8f6807c9d3ee6bcfac25aee832163036b4e6fe (diff)
Break out io code in libs
Preparing for adding more io implementations. Really tried writing the convention plugins in kotlin dsl but could not find the exact right hacks to get it to work.
Diffstat (limited to 'app/src/main/java/org/the_jk/cleversync/StringUtils.kt')
-rw-r--r--app/src/main/java/org/the_jk/cleversync/StringUtils.kt32
1 files changed, 0 insertions, 32 deletions
diff --git a/app/src/main/java/org/the_jk/cleversync/StringUtils.kt b/app/src/main/java/org/the_jk/cleversync/StringUtils.kt
deleted file mode 100644
index 6adea24..0000000
--- a/app/src/main/java/org/the_jk/cleversync/StringUtils.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package org.the_jk.cleversync
-
-object StringUtils {
- fun split(input: String, delimiter: Char, keepEmpty: Boolean = true, limit: Int = 0): List<String> {
- return buildList {
- var offset = 0
- var count = 0
- while (true) {
- val next = input.indexOf(delimiter, offset)
- if (next == -1) {
- if (keepEmpty || offset < input.length) {
- if (limit > 0 && count == limit) {
- add("${removeLast()}${delimiter}${input.substring(offset)}")
- break
- }
- add(input.substring(offset))
- }
- break
- }
- if (keepEmpty || offset < next) {
- if (limit > 0 && count == limit) {
- add("${removeLast()}${delimiter}${input.substring(offset)}")
- break
- }
- add(input.substring(offset, next))
- count++
- }
- offset = next + 1
- }
- }
- }
-}