From: Jeremy Potter Date: Wed, 8 Apr 2020 18:45:58 +0000 (+0000) Subject: Add strreplace to string documentation X-Git-Url: https://git.rm.cloudns.org/?a=commitdiff_plain;h=f3b426fcaf8befe546e2913ae4533f6a420e64ed;p=xonotic%2Fxonotic.wiki.git Add strreplace to string documentation --- diff --git a/Introduction-to-QuakeC.md b/Introduction-to-QuakeC.md index 6b8770f..0cd22f1 100644 --- a/Introduction-to-QuakeC.md +++ b/Introduction-to-QuakeC.md @@ -150,6 +150,11 @@ A *string* in QuakeC is an immutable reference to a null-terminated character st strstrofs("haystack", "ac", 0) == 5; ``` +- **strreplace(old, new, string)** searches for certain characters in a string and replaces them with other characters, as in: + ```c + strreplace("de", "con", "destruction") == "construction"; + ``` + The offset defines from which starting position to search, and the return value is `–1` if no match is found. The offset returned is *0*-based, and to search in the whole string, a start offset of *0* would be used. - **substring(string, startpos, length)** returns part of a string. The offset is *0*-based here, too.