replace character in line

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
DEHarwell
Newbie
Posts: 2
Joined: Thu Nov 17, 2005 5:07 am

replace character in line

Post by DEHarwell » Thu Nov 17, 2005 5:12 am

How do I replace a character in a line?
The character to replace is always in column 27

User avatar
JRL
Automation Wizard
Posts: 3532
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Post by JRL » Thu Nov 17, 2005 6:14 am

StringReplace>sourcestring,find,replace,newstring
Last edited by JRL on Thu Nov 17, 2005 2:01 pm, edited 1 time in total.

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Thu Nov 17, 2005 8:21 am

If it's always in the same position just use MidStr.
MJT Net Support
[email protected]

DEHarwell
Newbie
Posts: 2
Joined: Thu Nov 17, 2005 5:07 am

replace character in line

Post by DEHarwell » Thu Nov 17, 2005 12:59 pm

can you give me an example using MidStr?
- I am new at this stuff

User avatar
support
Automation Wizard
Posts: 1450
Joined: Sat Oct 19, 2002 4:38 pm
Location: London
Contact:

Post by support » Thu Nov 17, 2005 2:02 pm

If you always want to replace character 27 with A:

//extract chars 1 to 26
MidStr>line,1,26,firstbit

//extract chars 28 onwards
Length>line,L
MidStr>line,28,L,lastbit

//Put them together with replaced character:
Let>newline=%firstbit%A%lastbit%

If you just want to replace all occurences of a character in a string use the StringReplace function.
MJT Net Support
[email protected]

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts