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

strconv: deprecate v_sprintf in favor of string interpolation

This commit is contained in:
Alexander Medvednikov
2022-08-23 09:52:59 +03:00
parent a758b6686c
commit 2dde7ff5ba
6 changed files with 14 additions and 11 deletions

View File

@@ -23,6 +23,7 @@ enum Char_parse_state {
}
// v_printf prints a sprintf-like formated `string` to the terminal.
[deprecated: 'use string interpolation instead']
pub fn v_printf(str string, pt ...voidptr) {
print(v_sprintf(str, ...pt))
}
@@ -34,6 +35,7 @@ pub fn v_printf(str string, pt ...voidptr) {
// x := 3.141516
// assert strconv.v_sprintf('aaa %G', x) == 'aaa 3.141516'
// ```
[deprecated: 'use string interpolation instead']
[manualfree]
pub fn v_sprintf(str string, pt ...voidptr) string {
mut res := strings.new_builder(pt.len * 16)