Skip to content

joinString

ffredyk edited this page Jul 23, 2026 · 1 revision

joinString

Category

String

Arity

BinaryjoinString [array, separator].

joinString <array>   // [array, separator]

Description

Joins an array of strings into a single string, with the separator inserted between each element. Returns the joined string. The right operand is an array: [stringArray, separator].

How It Works

Calls string.Join(separator, stringArray). Each element in the array is converted to its string representation via str if not already a string. The separator is not added before the first element or after the last.

Usage

Basic join

joinString [["a", "b", "c"], "-"];   // "a-b-c"
joinString [["red", "green"], ", "];  // "red, green"

CSV generation

_fields = ["John", "Doe", "42"];
_csv = joinString [_fields, ","];     // "John,Doe,42"

Path building

_parts = ["scripts", "ai", "combat.sqf"];
_path = joinString [_parts, "\"];     // "scripts\ai\combat.sqf"

Sentence building

_words = ["Hello", "world", "from", "SQF"];
_sentence = joinString [_words, " "];  // "Hello world from SQF"

With numbers (auto-stringified)

joinString [[1, 2, 3], ", "];         // "1, 2, 3"

Empty array

joinString [[], ","];                  // "" (empty string)

Single element

joinString [["only"], ","];            // "only" (no separator added)

Thread Safety

ReadOnly — pure computation, returns new string. Safe from any scheduler.

See Also

  • splitString — reverse: split string into array
  • format — formatted string output
  • + — string concatenation
  • str — value to string

SQ# Wiki

Home

Engine Docs

Migration

Commands

Value Constructors

Arithmetic

Comparison

Logic

Array

String

Math

Random

Type & Introspection

HashMap

Code Execution

Concurrency

Scheduler

Thread Safety

Error

Output

Time

Multiplayer

Compiler

Clone this wiki locally