cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
Rayner
Level 4

How to find a string in Specific Position

How to find a string in Specific Position

For eg.) MyStr = "Testing"

If I pass parameter 4 to some function, it should return 't'. Anyway it can be done in install script?
Labels (1)
0 Kudos
(1) Reply
ch_eng
Level 7

Rayner,

There are a lot of ways you could do it using InstallScript String Functions
http:// helpnet.flexerasoftware.com/installshield21helplib/Subsystems/installshield21langref/helplibrary/LangrefString_functions.htm

Here is one example using CopyBytes
http:// helpnet.flexerasoftware.com/installshield21helplib/Subsystems/installshield21langref/helplibrary/LangrefCopyBytes.htm

//-------------------------------------------------------------------------

prototype STRING ExFn_CopyBytes( byval STRING, // szMyString
byval NUMBER ); // nPos


// szMyString = the string you are searching
// nPos = the position in the string that you want
function STRING ExFn_CopyBytes( szMyString, nPos )
STRING szFoundStr;
begin

// use 'number - 1' because CopyBytes is 0-based.
// passing "4" to find the "t" in "Testing" would actually be position 3
CopyBytes( szFoundStr, 0, szMyString, nPos - 1, 1 );

return szFoundStr;

end;


HTH
0 Kudos