sergeych / mp_stools

Collection of multiplatofrm string tools that does not exist on all platforms with the same interface: string and datetime formatting, etc. USeful fo write MP libraries and applications
MIT License
25 stars 0 forks source link

Convert negative Byte as Hexadecimal issue #6

Open 7loro opened 1 month ago

7loro commented 1 month ago

When -94 Byte is converted as hexadecimal In JVM, using string.format returns A2 (two's complement) However, below code using sprintf returns -5e ( 5e is 94. and - is just added)

val inputByte: Byte = -94
val formatted = "%x".sprintf(inputByte)
println(formatted)
sergeych commented 1 month ago

thanks for reporting. will fix