string manipulation

Dugger

New Member
Sorry for the easy one! I'm obviously new to Progress.

How do you add characters to a string?

For instance:
In the device field of the usrprint table I would like to add 5 characters in the middle of the string then update the printer default.

usrprint.device = "\\fcdsntsrv0\irlaser"
needs to be
usrprint.device = "\\fcdsntsrv0\ste1-irlaser"

The printer queues are changing in Syteline for our users with the move to Active Directory and there are about 450 users that need to have these defaults changed. Too many to do manually.

Progress 9.1C

Thanks,
Doug Brown
 
Well, the traditional way is to split the string into two using the SUBSTRING statement, and formulating the new string by concatenation.

But actually, in the 4GL, this isn't necessary. Using SUBSTRING you can replace one substring with another even though the substrings are of a different length. So it effectively inserts characters.

DEF VAR mystring AS CHAR NO-UNDO INITIAL "\\fcdsntsrv0\irlaser".

SUBSTRING(myString,13,1) = "\ste1-".

This basically tells Progress to replace the substring starting at character 13 with a length of 1 with the new string.
 
Back
Top