The online community for software testing & quality assurance professionals
   
Active Topics Today's Topics
Sponsors:
Lost Password?

Home
BetaSoft
Jobs
Training
News
Links
Downloads

News Group:
software.testing


Testing
Automation
Performance
Engineering
Miscellaneous
Statistics
Poll
  QA Forums
  WinRunner
  string replace function?

Post New Topic  Post A Reply
profile | register | preferences | faq | search

UBBFriend: Email This Page to Someone! next newest topic | next oldest topic
Author Topic:   string replace function?
WinRunner
Moderator

Posts: 9845
Registered: Mar 2001

posted 07-22-2002 04:51 PM     Click Here to See the Profile for WinRunner   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by WinRunner Visit WinRunner's Homepage!
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:

IP Logged

oleg888
Member

Posts: 14
Registered: Apr 2002

posted 07-22-2002 04:52 PM     Click Here to See the Profile for oleg888   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by oleg888
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;
}


IP Logged

cranem451
Guru

Posts: 395
Registered: Mar 2002

posted 07-22-2002 07:06 PM     Click Here to See the Profile for cranem451   Edit/Delete Message Copy This Message   Reply w/Quote Search for more posts by cranem451
Link to example code: 17368446.zip

Found this using the "Advanced search", added code to test it...

------------------
cranem451 - cranem@addendum.com

IP Logged

All times are PT (US)

next newest topic | next oldest topic

Administrative Options: Close Topic | Archive/Move | Delete Topic | Top
Post New Topic  Post A Reply
Hop to:

Contact Us | BetaSoft Inc. | Privacy Statement

Copyright © 1997-2003 BetaSoft Inc.


Ultimate Bulletin Board 5.45c