StringReplace

StringReplace will replace one or more values in an ascii, wide charactor or biniary string, to the replacement values.

TVariable StringReplace(
   const BYTE *search,
   const BYTE *replace,
   __int64 *count = NULL
);

TVariable StringReplace(
   const char16_t *search,
   const char16_t *replace,
   __int64 *count = NULL
);

TVariable StringReplace(
   const TVariable &search,
   const TVariable &replace,
   __int64 *count = NULL
);

Parameters

searchthe search string or search array, to be matched against the underlining string value.
replacethe replacement string or set of replacement values.
countreturn the count of successful matches and replacements.

Return Values

These methods will return the a temporary const value created on the stack.

Remarks

  • If the array is used, the position of the search array is replaced with the same position of the replacement array, if the replacement array is shorter, then the last value is repeated.
  • This method will return a TVariable of the same type as the original TVariable.
Example Use
  • C++
#include "TScript.h"

int wmain(int argc, wchar_t* argv[])
{
   TVariable var("123");
   MessageBox(var.StringReplace("1","2").WString());
   //will show message "223"
   return NO_ERROR;
}

Since

TScript Version 1.1.4

Also See

Copy, Position, Substring
Listen All
Comments (0)
Characters left: 2500
 
Ekky Software Homepage T-Accounts Online ObjectDatabase++ TScript Ekky Software Homepage T-Accounts Onlinee ObjectDatabase++ TScript