json_sjs1_2.12.4.0.2.source-code.ToDecimalByte.scala Maven / Gradle / Ivy
The newest version!
package ujson
object MathUtilsByte{
def toString(bytes: Array[Byte], index: Int, s: String) = {
val len = s.length
var i = 0
while (i < len) {
bytes(index + i) = s.charAt(i).toByte
i += 1
}
len
}
}
object DoubleToDecimalByte{
def toString(bytes: Array[Byte], index: Int, v: Double) = {
MathUtilsByte.toString(bytes, index, v.toString)
}
}
object FloatToDecimalByte{
def toString(bytes: Array[Byte], index: Int, v: Float) = {
MathUtilsByte.toString(bytes, index, v.toString)
}
}