GOLF(2gg)

πŸ“¦ version 601.4.41, in ubuntu questing

πŸ’– GOLF(2gg) β€” the concatenate-strings page, bestie edition πŸ’–

okay so real quick, this is page GOLF(2gg) from the Development manual, and it's literally all about smashing strings together. grab a snack, we're doing this πŸ“


✨ NAME ✨

concatenate-strings β€” (strings) πŸŽ€


🌸 PURPOSE 🌸

Add strings using a plus ("+") sign. that's it. that's the whole job. iconic behavior honestly πŸ’…


πŸ¦‹ SYNTAX πŸ¦‹

<string> + <string> [ + ... ]

like, keep stacking them. the [ + ... ] is your little invitation to go feral πŸ”₯


πŸ’œ DESCRIPTION πŸ’œ

So here's the vibe: string variables and string literals can produce a brand-new string by concatenation, and the whole thing runs on that plus ("+") clause. no cap.

And the way this is so flexible?? You can use concatenation in any statement where a string is expected. anywhere. any statement. she's welcome everywhere, main character energy fr fr πŸ‘‘

okay but the important bit β€” bestie, listen β€” you can concatenate binary strings too. yes, the ones that do not end with a null character. each binary string gets used in its true length, and the result will in general be a binary string. that's just how it is πŸ’€

🌈 EXAMPLES 🌈

okay first example, we're concatenating two string constants AND a variable called "var". watch:

set-string var = "day"
set-string newstr = "nice " + var + " it is!"
print-out newstr new-line

and the result? "nice day it is!" β€” we ate, no crumbs πŸ˜­πŸ’–


Second one, this is the practical girlie. Here, directory (that's variable "dir") is concatenated with a forward slash ("/") and then the file name (variable "file") to produce the full path of a file to read:

read-file dir+"/"+file to content

see how clean that is? full path, one line, slay ✨


πŸ‘‘ SEE ALSO πŸ‘‘

  • Strings

and the whole friend group, all of them, in order:

  • 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

also: See all documentation 🫢


okay that's the whole page, you're basically a string-concatenation expert now, i'm so proud of you πŸ₯Ή this was $VERSION from $DATE, mwah, go forth and plus things together πŸ’–πŸŽ€πŸ¦‹

πŸ“¦ where this page comes from