plugins/include/string.inc
changeset 833 732bedfcbe3e
parent 830 97cd070a7ffa
child 834 d6fac170d744
     1.1 --- a/plugins/include/string.inc	Tue May 22 15:42:18 2007 +0000
     1.2 +++ b/plugins/include/string.inc	Tue May 22 20:50:48 2007 +0000
     1.3 @@ -216,6 +216,36 @@
     1.4  	return BreakString(source, arg, argLen);
     1.5  }
     1.6  
     1.7 +/**
     1.8 + * Given a string, replaces all occurrences of a search string with a 
     1.9 + * replacement string.
    1.10 + *
    1.11 + * @param text			String to perform search and replacements on.
    1.12 + * @param maxlength		Maximum length of the string buffer.
    1.13 + * @param search		String to search for.
    1.14 + * @param replace		String to replace the search string with.
    1.15 + * @return				Number of replacements that were performed.
    1.16 + */
    1.17 +native ReplaceString(String:text[], maxlength, const String:search[], const String:replace[]);
    1.18 +
    1.19 +/**
    1.20 + * Given a string, replaces the first occurrence of a search string with a 
    1.21 + * replacement string.
    1.22 + *
    1.23 + * @param text			String to perform search and replacements on.
    1.24 + * @param maxlength		Maximum length of the string buffer.
    1.25 + * @param search		String to search for.
    1.26 + * @param replace		String to replace the search string with.
    1.27 + * @param searchLen		If higher than -1, its value will be used instead of
    1.28 + *						a strlen() call on the search parameter.
    1.29 + * @param replaceLen	If higher than -1, its value will be used instead of
    1.30 + *						a strlen() call on the replace parameter.
    1.31 + * @return				Index into the buffer (relative to the start) from where
    1.32 + *						the last replacement ended, or -1 if no replacements were
    1.33 + *						made.
    1.34 + */
    1.35 +native ReplaceStringEx(String:text[], maxlength, const String:search[], const String:replace[], searchLen=-1, replaceLen=-1);
    1.36 +
    1.37  /** 
    1.38   * Returns the number of bytes a character is using.  This is
    1.39   * for multi-byte characters (UTF-8).  For normal ASCII characters,