Page tree

Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.




Introduced in

Version:1.20

Description

Description:

Performs a string find / replace operation.

Every occurrence of

"

the find

"

parameter in

"

the base

string"

parameter is replaced with

"

the replace

"

parameter (can be empty).

The last parameter is true for case sensitive searches, false for insensitive. If ommitted, the search is case insensitive by default.

Syntax

Syntax:[base, find, replace, case
?
, start] call fn_vbs_replaceString
Parameters:
  • base: String - Base string to find / replace
within
  • in.
  • find: String - String to search for.
  • replace: String - String to replace the find string with.
  • case
?
  • (
v1
Optional. Should the search be case sensitive? Defaults to false if omitted
  • Case-sensitive or not (optional, default: false).
  • start (
v1
Optional.
  • Character index to start the find / replace operation from
. Default is 0 (
  • (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"
Example:
["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.