create a String from char* and usz? #2327
Answered
by
Book-reader
BigRobCoder
asked this question in
Q&A
-
|
I'm calling into a C library that returns a char* and size_t (aka usz?) length. Is there a way to create a |
Beta Was this translation helpful? Give feedback.
Answered by
Book-reader
Jul 24, 2025
Replies: 1 comment
-
|
you can slice it like this char* some_str = ..;
usz len = ..;
String string = (String)some_str[:len];it won't do any copies |
Beta Was this translation helpful? Give feedback.
0 replies
Answer selected by
BigRobCoder
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
you can slice it like this
char* some_str = ..; usz len = ..; String string = (String)some_str[:len];it won't do any copies