ReplaceString Function

Given a string, replaces all occurrences of a search string with a replacement string.

int ReplaceString(char[] text, int maxlength, const char[] search, const char[] replace, bool caseSensitive)

Parameters

char[] text

String to perform search and replacements on.

int maxlength

Maximum length of the string buffer.

const char[] search

String to search for.

const char[] replace

String to replace the search string with.

bool caseSensitive

If true (default), search is case sensitive.

Return Value

Number of replacements that were performed.

Errors

'search' parameter is empty.