mirror of
https://github.com/mamoe/mirai.git
synced 2025-01-07 00:20:09 +08:00
Fix unexpected space at the end of toUHexString
result
This commit is contained in:
parent
7b5ca9f6a4
commit
c2d2be6c0a
@ -15,10 +15,10 @@ fun ByteArray.toUHexString(separator: String = " ", offset: Int = 0, length: Int
|
||||
return buildString(length * 2) {
|
||||
this@toUHexString.forEachIndexed { index, it ->
|
||||
if (index in offset until lastIndex) {
|
||||
var ret = it.toByte().toUByte().toString(16).toUpperCase()
|
||||
var ret = it.toUByte().toString(16).toUpperCase()
|
||||
if (ret.length == 1) ret = "0$ret"
|
||||
append(ret)
|
||||
if (index != lastIndex) append(separator)
|
||||
if (index < lastIndex - 1) append(separator)
|
||||
}
|
||||
}
|
||||
}
|
||||
@ -34,7 +34,7 @@ fun UByteArray.toUHexString(separator: String = " ", offset: Int = 0, length: In
|
||||
var ret = it.toByte().toUByte().toString(16).toUpperCase()
|
||||
if (ret.length == 1) ret = "0$ret"
|
||||
append(ret)
|
||||
if (index != lastIndex) append(separator)
|
||||
if (index < lastIndex - 1) append(separator)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user