Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

builtin: add string to u8 array support #20736

Merged
merged 4 commits into from Feb 6, 2024

Conversation

kbkpbot
Copy link
Contributor

@kbkpbot kbkpbot commented Feb 6, 2024

u8_array returns the value of the hex/bin string as u8 array.
hex string example: '0x11223344ee'.u8_array() == [u8(0x11),0x22,0x33,0x44,0xee].
bin string example: '0b1101_1101'.u8_array() == [u8(0xdd)].
underscore in the string will be stripped.

This will help convert a hex/bin format string into a u8 array.

vlib/builtin/string.v Outdated Show resolved Hide resolved
Copy link
Member

@spytheman spytheman left a comment

Choose a reason for hiding this comment

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

Excellent work.

vlib/builtin/string.v Outdated Show resolved Hide resolved
@spytheman spytheman merged commit 7fd1b16 into vlang:master Feb 6, 2024
54 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.

None yet

2 participants