X-Git-Url: http://git.xonotic.org/?a=blobdiff_plain;f=Introduction-to-QuakeC.md;h=aaa5fe20cc0df577a13e510f7da0a95112666199;hb=b97371e5b4d06ff596e18044024a8d5fdb561ceb;hp=6b8770f9eec2c5dba9284215c9a7c6718c20b07c;hpb=20bf8b2a0b43ab46cd9716a2444a181a044bb923;p=xonotic%2Fxonotic.wiki.git diff --git a/Introduction-to-QuakeC.md b/Introduction-to-QuakeC.md index 6b8770f..aaa5fe2 100644 --- a/Introduction-to-QuakeC.md +++ b/Introduction-to-QuakeC.md @@ -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: