Advanced Installer
more / weitere

InstallShield und AdminStudio Schulungen

weitere Infos

InstallShield InstallScript: Strings

Note regarding InstallScript versions: The samples on this page have been developed with various versions of InstallShield. Some of them require a minimum InstallShield version or may only work in the one version they have been created for. Often it will be possible to make them compatible with other InstallShield versions.

Changing Backslashes to Forward Slashes

Here's an IS5 function that changes all backslashes (\) to foreward (/) slashes in a path. Useful when configuring some webservers, java related stuff, etc. Test program included...

prototype SlashSwitch(STRING, BYREF STRING);

ZIP (449 Bytes)   Provided by Brian Bergstrom

Compare Two Strings With Case Sensitivity

This routine replaces InstallShield's StrCompare function which  is not case sensitive (which is required for passwords). It compares string length first, then the string content, byte by byte.

prototype CompareStrings(STRING, STRING)

ZIP (749 Bytes)    Provided by Tom LaRoche

Another solution would be to call the lstrcmp WinAPI. It returns 0 if the strings are identical:

prototype INT KERNEL.lstrcmp(STRING, STRING);

Enhanced StrGetTokens Function

If you call StrGetTokens with "\n" as delimiter, a 0x0d character is appended to the tokens. This wrapper for StrGetTokens removes the trailing 0x0d characters from the tokens.

prototype MyStrGetTokens(BYREF LIST, STRING, STRING);

ZIP   Written by Stephan Hagedorn
File size: 788 bytes   Last update: 2000-11-10

Extract a Delimited Piece of a String

This subroutine returns the nPiece-th piece of string szString, delimited by szDelim, in szPiece. For example,

GetSystemInfo (DATE, szDate, nNotUsed); // "3-12-1999"
StrPiece (szDayOfMonth, szDate, "-", 2); // "12"

Now szDayofMonth contains the day of the month.


ZIP   Written by Alan Frank
File size: 735 bytes   Last update: 03/22/1999

Format Date String

This function parses the date returned by GetSystemInfo into different, predefined formats.


ZIP (6.405 Bytes)    Provided by Andy Piper

Format Number as String

This function takes a number variable and returns a string properly formatted with commas. That is, the number 1234567 is returned as a string "1,234,567".

prototype FormatNumber( NUMBER, BYREF STRING );

ZIP   Written by Christine Madsen
File size: 511 bytes   Last update: 2001-06-22

Generate a Per-User Serial Number

Here is a function that generates a checksum from a string, for example the user's name. This can be very useful for taking the users name from a registration dialog and the serial number with either characters or numbers and compare them for validation. If a software developer wants to issue a different password that was contingent on the users name and company name, it would be very easy to do as you can imagine. The function was written as a companion to the Registration Dialog with Dynamic Serial Number Validation.

prototype String2Password( BYREF NUMBER, STRING );

ZIP (551 Bytes)   Provided by Dave Collins

Path Buffer Functions that Support Long Path Names

InstallShield's path buffer functions (PathAdd, PathDelete, PathGet, etc.) only work with short path names in 8.3 form. These wrapper functions call LongPathToShortPath before the path buffer function, and LongPathFromShortPath afterwards. The wrappers take the same parameters as the original functions, so you can easily replace them.

prototype MyPathSet(STRING);
prototype MyPathGet(BYREF STRING);
prototype MyPathDelete(STRING, NUMBER);
prototype MyPathClear();

ZIP   Written by Stephan Hagedorn
File size: 1.537 bytes   Last update: 2000-11-10

Special version for IPSE 6.x to work around a bug in the PathAdd function.

Fixed handling of trailing backslashes

ZIP   Written by Stephan Hagedorn
File size: 3.661 bytes   Last update: 2001-09-15

Prepare String for Multiline Registry Entry

The tokens in a multiline registry string are separated by NULL characters, but InstallShield can't handle strings that contain NULLs. The solution: Use a different delimiting character, and replace this with NULLs immediately before you call the registy function.

prototype ChangeToNulls(BYREF STRING, STRING);

ZIP    Written by Ed Smiley
File size: 882 bytes   Last update: 05/27/1999

Replace a String in a File

This is a function to find and repplace a string in a file. It takes 3 string args, 1st one being the file to examine, 2nd
string to search for, 3rd the string to replace with.

ZIP   Written by Dinesh Patel
File size: 1.212 bytes   Last update: 2003-03-21

Replace a String in a String

This code replaces a whole string within a string. Several supporting routines are provided so that _StrReplace will compile and be usable in its submitted form. So that some of these ancillary routines would not be "lonely," some of their siblings even though they are not all necessary for _StrReplace.


ZIP   Written by James Frater
File size: 2.501 bytes   Last update: 03/15/1999

Remove Whitespaces from a String

Remove All Whitespaces

All whitespace characters (blanks and tabs) will be eliminated from the string.

prototype OmaStrCutSpaces (STRING, BYREF STRING);

ZIP    Written by Jussi T. Rajala
File size: 777 bytes   Last update: 2000-01-29

Remove Leading and Trailing Whitespaces

Whitespaces (blanks and tabs) will be eliminated in the beginning and end from the given string.

prototype stdmiscStringTrim(BYREF STRING);

ZIP (715 Bytes)    Provided by Richard Lippmann

Resolve Pointer to String

Sometimes an API call requires or returns a pointer to a string. In IS5/6 indirection is only possible for number variables. The PointerToStr function serves as indirection for strings, so you can obtain the string value stored at the memoty location referenced by a pointer variable. Example:

STRING svText ;
POINTER psvText ;

psvText = &svText;
prototype PointerToStr(BYREF STRING, POINTER)

ZIP   Written by Ide Nentjes
File size: 768 bytes   Last update: 2001-08-04

Sorting a String List

FixList is a function that will take a stringlist and do the following:

prototype FixList(BYREF LIST, NUMBER);

ZIP (1.971 Bytes)   Provided by Christine Madsen

Test Whether a String is Alphanumeric

This function tests whether a string contains only characters from the set "abcdefghijklmnopqrstuvwxyz_0123456789"

prototype IsAlphanumeric (STRING);

ZIP   Written by Alan Frank
File size: 581 bytes   Last update: 03/22/1999




English News Discussions Windows Installer Related Tools More Help InstallScript About InstallSite Shop Site Search
deutsch Neuigkeiten Diskussionsgruppen Windows Installer MSI FAQ Artikel     Shop Suche

Copyright © by InstallSite Stefan Krueger. All rights reserved. Legal information.
Impressum/Imprint Datenschutzerklärung/Privacy Policy
By using this site you agree to the license agreement. Webmaster contact