close Warning: Can't synchronize with repository "(default)" (/var/svn/tolp does not appear to be a Subversion repository.). Look in the Trac log for more information.

Opened 17 years ago

Closed 17 years ago

#524 closed defect (fixed)

Replace fails when Old and New are the same

Reported by: Christian Paz Owned by: Víctor de Buen Remiro
Priority: highest Milestone:
Component: Text Version: 1.1.6
Severity: normal Keywords:
Cc:

Description

When you call the function Replace with the same character to be replaced and being replaced, there is an error.

I think there are two possible solutions, or comparing oldChar and newChar, or changing line:

while(pos=strchr(pos, oldChar))

by

while(pos=strchr(pos+1, oldChar))

in BInt BText::Replace(BChar oldChar, BChar newChar)

It could be great if we take advantage of this change to allow replacing strings as well as unit characters.

Thanks in advance,
Christian

Change History (2)

comment:1 Changed 17 years ago by Víctor de Buen Remiro

Owner: changed from danirus to Víctor de Buen Remiro

comment:2 Changed 17 years ago by Víctor de Buen Remiro

Resolution: fixed
Status: newclosed

First option is more efficient due it must do nothing in this case

Thanks to report it

Note: See TracTickets for help on using tickets.