Find String Operator (%)

InstallShield 2019 » InstallScript Language Reference

Use the boolean Find String operator ( % ) to determine if one string is a substring of another string. The following example tests szStringVarA to determine if it contains the string “sample.” If it does, then MessageBox is called to display a message.

    szStringVarA = "This is a sample string.";

        if (szStringVarA % "sample") then

        MessageBox("Variable contains 'string'.",INFORMATION);

    endif;

The character comparison is not case-sensitive. In the following example, the message box will be displayed:

    typedef  DIMENSIONS

    begin

      SHORT sLength;

      SHORT sWidth;

    end;

 

    DIMENSIONS Table;

    NUMBER   nvNumValue;

    DIMENSIONS  POINTER    pointerObject;

 

    begin

      pointerObject = &Table;

      pointerObject->sLength = 500;

      pointerObject->sWidth = 750;

Note • The InstallScript function StrFind also determines if a substring is contained within another string. If the substring is found, StrFind returns its position within the string.