AppCtrlScript

MAY Computer

Help

STRREDUCE

Applies to  

AppCtrlScript (Module: wmACScr1.dll)

Group  

String

See also  

REPLACE, STRREMLEADEND

Replaces multiple occurrences of a string (in line) with the specified replacement string. If a replacement is not specified then it is assumed that you want to replace multiple occurrences of a string with a single occurrence of the string.

This function is to reduce multiple spaces in a string to a single space for example.

Syntax

STRREDUCE <VariableName>, <Source>, <MultiOccSearch>[,  <Replacement>][, <CaseSense>] 

Part

Description

<VariableName> Name of the script variable where to store the result.
<Source> Source string.
<MultiOccSearch> The string that could occur multiple times one immediately after the other.
<Replacement> New string multiple occurrences of <MultiOccSearch> should be replaced with. If missing then <MultiOccSearch> is assumed to be the new string.
<CaseSense> Optional 0 or 1, if 1 then the search string is case sensitive. The default is 1 (case sensitive search).

 

Samples

STRREDUCE MyVar, "asdf asdf     xxx", " "
MSGBOX %SCR.MyVar%
;MyVar will be "asdf asdf xxx"

STRREDUCE MyVar, "asdfasdf     xxx", "ASDF", "_", 0
MSGBOX %SCR.MyVar%
;MyVar will be "_     xxx"