GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

✨ GOLF(2gg) ✨

okay bestie, welcome to the Development section of the 2gg manual, and today's main character is GOLF(2gg) β€” no wait, it's the page about copy-string, but the manual it lives in is literally called GOLF(2gg) and yes that's iconic of it πŸ’…


πŸŽ€ NAME πŸŽ€

copy-string β€” (strings)


πŸ’– PURPOSE πŸ’–

Copies string to another string. that's it. that's the whole vibe. πŸ¦‹


⭐ SYNTAX ⭐

copy-string <source string> to <dest string> \
    [ start-with <start with> ] \
    [ length <length> ]

🌸 DESCRIPTION 🌸

Use copy-string to copy <source string> to <dest string>. simple as. 🫢

The <start with> number (over in the "start-with" clause, iykyk) is the position in <source string> to start copying from, with 0 being the first byte. zero-indexed girlies rise πŸ™ˆ

Without the "length" clause, the whole of <source string> gets copied. With the "length" clause, exactly <length> bytes are copied into <dest string>. exactly exactly. no crumbs left. πŸ”₯

And here's the plot twist bestie β€” you can copy a string to itself. In this case, the original string remains and the new string references a copy. it's giving clone arc πŸ‘‘

set-string str = "original string" // string to change

set-string orig = str // references original copy of the string to change

copy-string str to str // make a copy of string to change and assign it to itself

upper-string str // change the copy

// Now "str" references "ORIGINAL STRING"
// and "orig" references "original string"

πŸ’œ EXAMPLES πŸ’œ

After the copy-string below, "my_str" will be a copy of string "some value":

set-string other_string="some value"
copy-string other_string to my_str

Copy certain number of bytes, the result in "my_str" will be "ome":

set-string other_string="some value"
copy-string other_string to my_str length 3 start-with 1

ngl that second one is so satisfying, like a lil snack of bytes πŸ“


🌈 SEE ALSO 🌈

  • Strings
  • 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

and that's a wrap, bestie πŸ’… this lil masterpiece came from version $VERSION, dated $DATE, and it's filed under GOLF(2gg) β€” periodt πŸŽ€βœ¨πŸ’–

πŸ“¦ where this page comes from