File tree Expand file tree Collapse file tree 3 files changed +9
-6
lines changed
main/kotlin/io/github/techouse/qskotlin/internal
test/kotlin/io/github/techouse/qskotlin/unit Expand file tree Collapse file tree 3 files changed +9
-6
lines changed Original file line number Diff line number Diff line change 1616! ** /src /main /** /out /
1717! ** /src /test /** /out /
1818
19+ # # Gradle ###
20+ local.properties
21+
1922# ## Kotlin ###
2023.kotlin
2124
4245.vscode /
4346
4447# ## Mac OS ###
45- .DS_Store
48+ .DS_Store
Original file line number Diff line number Diff line change @@ -113,7 +113,7 @@ internal object Decoder {
113113 key = options.getDecoder(part, charset).toString()
114114 value = if (options.strictNullHandling) null else " "
115115 } else {
116- key = options.getDecoder(part.substring( 0 , pos), charset).toString()
116+ key = options.getDecoder(part.take( pos), charset).toString()
117117 value =
118118 Utils .apply<Any ?>(
119119 parseListValue(
@@ -210,7 +210,7 @@ internal object Decoder {
210210 } else cleanRoot
211211
212212 val index: Int? =
213- if (decodedRoot.isNotEmpty() && decodedRoot.all( Char ::isDigit) )
213+ if (decodedRoot.isNotEmpty() && decodedRoot.toIntOrNull() != null )
214214 decodedRoot.toInt()
215215 else null
216216
@@ -312,7 +312,7 @@ internal object Decoder {
312312 val segments = ArrayList <String >(key.count { it == ' [' } + 1 )
313313
314314 val first = key.indexOf(' [' )
315- val parent = if (first >= 0 ) key.substring( 0 , first) else key
315+ val parent = if (first >= 0 ) key.take( first) else key
316316 if (parent.isNotEmpty()) segments.add(parent)
317317
318318 var open = first
Original file line number Diff line number Diff line change @@ -523,9 +523,9 @@ class DecodeSpec :
523523 decode(" a[0]=b" , DecodeOptions (listLimit = 0 )) shouldBe mapOf (" a" to listOf (" b" ))
524524
525525 decode(" a[-1]=b" , DecodeOptions (listLimit = - 1 )) shouldBe
526- mapOf (" a" to mapOf (" -1 " to " b" ))
526+ mapOf (" a" to mapOf (- 1 to " b" ))
527527 decode(" a[-1]=b" , DecodeOptions (listLimit = 0 )) shouldBe
528- mapOf (" a" to mapOf (" -1 " to " b" ))
528+ mapOf (" a" to mapOf (- 1 to " b" ))
529529
530530 decode(" a[0]=b&a[1]=c" , DecodeOptions (listLimit = - 1 )) shouldBe
531531 mapOf (" a" to mapOf (0 to " b" , 1 to " c" ))
You can’t perform that action at this time.
0 commit comments