]> de.git.xonotic.org Git - xonotic/xonotic.wiki.git/blobdiff - Introduction-to-QuakeC.md
minor change
[xonotic/xonotic.wiki.git] / Introduction-to-QuakeC.md
index e52a160477522955963e2fba92e40dcdfec4823d..aaa5fe20cc0df577a13e510f7da0a95112666199 100644 (file)
@@ -152,7 +152,17 @@ A *string* in QuakeC is an immutable reference to a null-terminated character st
 
 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.
+-   **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";
+    ```
+
+-   **substring(string, startpos, length)** returns part of a string.
+
+The offset is *0*-based here, too. A length of `-1` designates the end of the string (it will return the part of the string after the start position), a length of `-2` designates the penultimate character of the string, and so on.
+
+-   **strtoupper(string)** capitalizes a string.
+-   **strtolower(string)** lowercases a string.
 
 Note that there are different kinds of *strings*, regarding memory management:
 
@@ -271,7 +281,7 @@ A special kind of functions are the built-in functions, which are defined by the
 string strcat(string a, string b, ...) = #115;
 ```
 
-The function/field syntax is ambiguous. In global scope a declaration can be a variable, field or function. In local scope, it's always a variable. The `var` keyword can be used in global scope to treat is as local scope (always declaring a variable). The following table shows declarations in global scope:
+The function/field syntax is ambiguous. In global scope a declaration can be a variable, field or function. In local scope, it's always a variable. The `var` keyword can be used in global scope to treat it as local scope (always declaring a variable). The following table shows declarations in global scope:
 
 | Example code | Meaning |
 |--------------|---------|