Skip to content

strings: make strings end with zero in repeat() and repeat_string()#25624

Merged
spytheman merged 1 commit into
vlang:masterfrom
tankf33der:strings_repeat
Oct 30, 2025
Merged

strings: make strings end with zero in repeat() and repeat_string()#25624
spytheman merged 1 commit into
vlang:masterfrom
tankf33der:strings_repeat

Conversation

@tankf33der

Copy link
Copy Markdown
Contributor

In these two functions the created strings are end with zero and not with NULL.
Demo:

import strings

fn main() {
        s := strings.repeat(48, 3)
        for i in 0 .. 10 {
                unsafe { C.printf(c'%d\n', s.str[i]) }
        }
}

p.s. for another module decided to create a separate PR for the sake of cleanliness

@spytheman spytheman left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you @tankf33der 🙇🏻 .

@spytheman spytheman merged commit f001561 into vlang:master Oct 30, 2025
79 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants