GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

✨ GOLF(2gg) ✨

okay bestie, welcome to the GOLF manual, section 2gg β€” it's giving Development, it's giving dev tools, and honestly? it's iconic. sit down, grab a boba, we're learning about strings πŸ’–


πŸŽ€ NAME πŸŽ€

string-length β€” it lives in the (strings) family, iykyk πŸ¦‹


🌸 PURPOSE 🌸

Get string length. that's it. that's the whole job. and it ate πŸ’…


🧚 SYNTAX 🧚

string-length <string> to <length>

πŸ’œ DESCRIPTION πŸ’œ

okay so here's the tea: string-length will place the number of bytes in <string> into the number <length>. no cap, that's literally all it does and it does it flawlessly πŸ‘‘

heads up though bestie β€” <string> does not need to be null-terminated. which means it can be a binary string or a text string, whichever vibe it's serving. and <length>? that's just the number of bytes comprising any such string. simple. clean. gorgeous. ✨

🌈 EXAMPLES 🌈

first up β€” the variable "len" will be 6 πŸ“:

set-string str = "string"
string-length str to len

and next β€” the variable "len2" will be 18, because bestie the string has a null character right in the middle of it 😭:

set-string str2 = "string" "\x00 after null"
string-length str2 to len2

see how the null in the middle doesn't trip it up? main character energy fr fr πŸ’…


πŸ‘‘ SEE ALSO πŸ‘‘

  • Strings

and the whole squad, the entire friend group, the full roster πŸ’–:

concatenate-strings copy-string count-substring delete-string lower-string new-string read-split replace-string set-string split-string string-length trim-string upper-string write-string

See all documentation β€” yes there's more, go explore, you got this 🫢


that's the whole page bestie!! this edition dropped on $DATE and it's version $VERSION, all wrapped up under the GOLF(2gg) banner β€” stay slay, stay stringy, mwah πŸ’‹πŸ’–

πŸ“¦ where this page comes from