Page tree
Skip to end of metadata
Go to start of metadata




Introduced in

Version:1.20

Description

Description:

Performs a string find / replace operation.

Every occurrence of the find parameter in the base parameter is replaced with the replace parameter (can be empty).

Syntax

Syntax:[base, find, replace, case, start] call fn_vbs_replaceString
Parameters:
  • base: String - Base string to find / replace in.
  • find: String - String to search for.
  • replace: String - String to replace the find string with.
  • case (V1.22+): Boolean - Case-sensitive or not (optional, default: false).
  • start (V1.34+): Number - Character index to start the find / replace operation from (optional, default: 0, which indicates the first character).
Return Value:String

Warning

When using functions in VBS versions older than 3.4, certain limitations and requirements should be kept in mind - the main ones being that capitalization of the function name is crucial, and that #include "\vbs2\headers\function_library.hpp" has to be included in every script that utilizes it. More Category VBS Scripting Functions.

Examples

Examples:
["abc", "bC", "dEf"] call fn_vbs_replaceString
// Returns: "adEf"
["abcabc", "bC", "dEf", false, 2] call fn_vbs_replaceString
// Returns: "abcadEf" 

Additional Information

See also: fn vbs filterString
Multiplayer: 
Problems: 

Notes







Note: the case-sensitive replacement option is available in versions below v1.22, but is bugged and does not work properly.