|
Author
|
Topic: string replace function?
|
WinRunner Moderator
   
Posts: 9845 Registered: Mar 2001
|
posted 07-22-2002 04:51 PM
User ethoha (ethoha@yahoo.com.nospam) posted:
Since the data I use is from a spreadsheet, it looks like that I have to escape the minuses (and probably many other characters) before I can type it. Is there an easy way of doing this, like a string replace function? Looking at the string functions in the reference guide, it looks like I have to use split(), then loop through the array and join it together. Am I overlooking something obvious?
--- In winrunner@y..., Roman Zilber wrote:

|
oleg888 Member
Posts: 14 Registered: Apr 2002
|
posted 07-22-2002 04:52 PM
User Komanovsky, Oleg (okomanovsky@evolve.com.nospam) posted:
------_=_NextPart_001_01C231DA.EEA09C90 Content-Type: text/plain
############### Replaces every occurance in the string ############# function ReplaceChr (in sStr, in sFindWhat, in sReplaceWith) { auto iPos; auto sStrTemp;
if ( match ( sStr, sFindWhat ) == 0 ) { return sStr; } while ( TRUE ) { if ( match ( sStr, sFindWhat ) != 0 ) { iPos = match (sStr, sFindWhat); sStrTemp = sStrTemp & substr ( sStr, 1, iPos - 1 ) & sReplaceWith;
sStr = substr (sStr, iPos + length (sFindWhat) );
} else { return sStrTemp = sStrTemp & sStr; } } return sStrTemp; }

|
cranem451 Guru
   
Posts: 395 Registered: Mar 2002
|
posted 07-22-2002 07:06 PM
Link to example code: 17368446.zipFound this using the "Advanced search", added code to test it... ------------------ cranem451 - cranem@addendum.com

| |