1
0
mirror of https://github.com/vlang/v.git synced 2023-08-10 21:13:21 +03:00

strconv: remove deprecations for strconv.v_sprintf and strconv.v_printf (part 1)

This commit is contained in:
Delyan Angelov 2023-07-10 17:42:29 +03:00
parent e7af25ec14
commit 6b00685629
No known key found for this signature in database
GPG Key ID: 66886C0F12D595ED

View File

@ -23,20 +23,24 @@ enum Char_parse_state {
}
// v_printf prints a sprintf-like formated `string` to the terminal.
[deprecated: 'use string interpolation instead']
// The format string `str` can be constructed at runtime.
// Note, that this function is unsafe.
// In most cases, you are better off using V's string interpolation,
// when your format string is known at compile time.
fn v_printf(str string, pt ...voidptr) {
print(v_sprintf(str, ...pt))
}
// v_sprintf returns a sprintf-like formated `string`.
//
// The format string `str` can be constructed at runtime.
// Note, that this function is unsafe.
// In most cases, you are better off using V's string interpolation,
// when your format string is known at compile time.
// Example:
// ```v
// x := 3.141516
// assert strconv.v_sprintf('aaa %G', x) == 'aaa 3.141516'
// ```
[deprecated: 'use string interpolation instead']
[deprecated_after: '2023-06-30']
[direct_array_access; manualfree]
pub fn v_sprintf(str string, pt ...voidptr) string {
mut res := strings.new_builder(pt.len * 16)