mirror of
https://github.com/Ed94/Odin.git
synced 2026-08-05 15:18:49 +00:00
Tetralux asked for int_tostring() to also be deprecated, use write_int() instead.
This commit is contained in:
@@ -1546,35 +1546,6 @@ write_u128 :: proc(buf: []byte, u: u128, base: int) -> string {
|
||||
return write_bits_128(buf, u, base, false, 8*size_of(uint), digits, nil)
|
||||
}
|
||||
|
||||
/*
|
||||
`itoa` C name deprecated, use `int_to_string` instead (same procedure)
|
||||
|
||||
Converts an integer value to a string and stores it in the given buffer
|
||||
|
||||
**Inputs**
|
||||
- buf: The buffer to store the resulting string
|
||||
- i: The integer value to be converted
|
||||
|
||||
Example:
|
||||
|
||||
import "core:fmt"
|
||||
import "core:strconv"
|
||||
int_to_string_example :: proc() {
|
||||
buf: [4]byte
|
||||
result := strconv.int_to_string(buf[:], 42)
|
||||
fmt.println(result, buf) // "42"
|
||||
}
|
||||
|
||||
Output:
|
||||
|
||||
42 [52, 50, 0, 0]
|
||||
|
||||
**Returns**
|
||||
- The resulting string after converting the integer value
|
||||
*/
|
||||
int_to_string :: proc(buf: []byte, i: int) -> string {
|
||||
return write_int(buf, i64(i), 10)
|
||||
}
|
||||
/*
|
||||
`ftoa` C name deprecated, use `int_to_string` instead (same procedure)
|
||||
|
||||
|
||||
Reference in New Issue
Block a user