Pattern for string with size? #1937
Answered
by
jumanji144
danielniccoli
asked this question in
Get Help
-
Hi, I have the following data which translates to a string.
The first byte gives the length of the string and then you have the string. I have the following pattern that works:
I wonder if there's maybe a better way to do this? |
Beta Was this translation helpful? Give feedback.
Answered by
jumanji144
Oct 18, 2024
Replies: 1 comment
-
Hello, yes there is a better way. Check out the standard library type: import type.magic;
std::string::SizedString<u8> string @ 0x0a; |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
danielniccoli
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Hello, yes there is a better way. Check out the standard library type:
std::string::SizedString
from thetype.magic
library. In this case you'd use it like this: