Jump to content


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.
Photo

String Cropping


4 replies to this topic

jdduffy

jdduffy
  • Members
  • 4 posts

Posted 28 February 2005 - 23:20

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?

Ioana

Ioana
  • Members
  • 41 posts

Posted 01 March 2005 - 11:22

Hello,
Try this way:

STRING szString, szNewString;
............................................
szString = "m:";
szNewString[0] = szString[0];
szNewString[1] = '\0';

jdduffy

jdduffy
  • Members
  • 4 posts

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:.)

Xitch13

Xitch13
  • Members
  • 134 posts

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


There is great chaos under heaven, and the situation is excellent. (Mao Tse Tung)

jdduffy

jdduffy
  • Members
  • 4 posts

Posted 09 March 2005 - 20:47

Great! I was able to resolve my issue using a combination of all your suggestions!