Hey Everyone,
I am new to the IS development world and have run across and issue that I can not find help on within the On-Line help for IS Professional v7. I have a string that is defined as "m:" and I need it to read just "m". How can I perform this task using IS scripting?
This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.

String Cropping
Started by
jdduffy
, Feb 28 2005 23:20
4 replies to this topic
Posted 01 March 2005 - 11:22
Hello,
Try this way:
STRING szString, szNewString;
............................................
szString = "m:";
szNewString[0] = szString[0];
szNewString[1] = '\0';
Try this way:
STRING szString, szNewString;
............................................
szString = "m:";
szNewString[0] = szString[0];
szNewString[1] = '\0';
Posted 01 March 2005 - 14:04
Sorry, but I don't completely understand how I would code this. Again, please be patient with me since I am just learning.
To better explain my situation, the "m:" that I have is really a variable that I get from user input based on where they want the system to install too. So this variable could be different based on what drive letter the user chooses. (ie. M:, S:, T:)
Then what I am needing to do with the variable is crop the ":" off of it so that I can use it in a REGDBGETKEYVALUEEX function to read the registry on the server to get the following value:
[HKCU]\Network\drive letter\RemotePath (where the drive letter is the M:.)
To better explain my situation, the "m:" that I have is really a variable that I get from user input based on where they want the system to install too. So this variable could be different based on what drive letter the user chooses. (ie. M:, S:, T:)
Then what I am needing to do with the variable is crop the ":" off of it so that I can use it in a REGDBGETKEYVALUEEX function to read the registry on the server to get the following value:
[HKCU]\Network\drive letter\RemotePath (where the drive letter is the M:.)
Posted 01 March 2005 - 17:29
I'd use StrSub() that gets a substring from a string.
You knbow whatever answer is returnbed you just want to grab the first byte so
szPathString - this is the path you get back from the user (D:, M:, E:, etc)
szDrive - this will hold the drive letter
just use this line
StrSub (szDrive, szPathString, 0, 1);
That will chop off the first byte of your string (starting at the 0 byte, and going for 1 byte), and store it in the variable szDrive
HTH
You knbow whatever answer is returnbed you just want to grab the first byte so
szPathString - this is the path you get back from the user (D:, M:, E:, etc)
szDrive - this will hold the drive letter
just use this line
StrSub (szDrive, szPathString, 0, 1);
That will chop off the first byte of your string (starting at the 0 byte, and going for 1 byte), and store it in the variable szDrive
HTH
There is great chaos under heaven, and the situation is excellent. (Mao Tse Tung)
Posted 09 March 2005 - 20:47
Great! I was able to resolve my issue using a combination of all your suggestions!