String Indexing

InstallShield 2016 ยป InstallScript Language Reference

A string variable is an array of Unicode characters with a null terminator. You can reference individual characters within a string by specifying the string name followed by an index value within square brackets. Note that the first character in a string is in position 0.

In the example below, the function BlankLeadingZeros uses the string indexing technique to replace leading zeros in the string representation of a number with blank characters.

    prototype BlankLeadingZeros(BYREF STRING);

 

function BlankLeadingZeros(szString)

  INT iVal, iLength;

begin

  iVal = 0;

  iLength = StrLength (szString);

 

  while (szString[iVal] = "0") && (iVal <= iLength)

    szString[iVal] = " ";

    iVal++;

  endwhile;

end;

See Also