Item5471: The character 0 cannot be replaced using the replace-funtion of the SpreadSheetPlugin

pencil
Priority: Normal
Current State: Closed
Released In: 1.0.5
Target Release: patch
Applies To: Extension
Component: SpreadSheetPlugin
Branches:
Reported By: TWiki:Main.SebastianKlus
Waiting For:
Last Change By: KennethLavrsen

Replace Function does not work properly in SpreadSheetPlugin

Trying to replace the character 0 within a text string, using the replace funtion of the SpreadSheetPlugin does not work.

For example:

 %CALC{"$REPLACE(Sebastian, 2, 1, .)"}% 

results in:
S.bastian

So this works fine.

2nd example:

 %CALC{"$REPLACE(11xxx, 2, 1, .)"}% 

results in:
1.xxx

So this works fine, too.

But:

 %CALC{"$REPLACE(10xxx, 2, 1, .)"}% 

results in:
1.xxx

So here it does not work.

-- TWiki:Main/SebastianKlus - 24 Mar 2008

Sebastian is right. The 0 doesn't get replaced if the num parameter is 1. Strange effect. I don't understand why the substr( ) code in SpreadSheetPlugin/Calc.pm does even work. Peter will know.

-- TWiki:Main.FranzJosefGigler - 25 Mar 2008

Found the support topic TWiki:Support.UnableToForceLinkNameTo0 which shows similar effect in totally different context. 0 seems to be somehow problematic.

-- TWiki:Main.FranzJosefGigler - 14 Apr 2008

Bug confirmed, needs to be fixed. $FIND, $SEARCH and $SUBSTITUTE seem to have the same bug.

-- TWiki:Main.PeterThoeny - 16 Apr 2008

Both REPLACE, FIND, SEARCH and SUBSTITUTE should be more robust now. I also added additional test cases in TestCases web for these.

-- KennethLavrsen - 22 Apr 2009
Topic revision: r12 - 25 Apr 2009, KennethLavrsen
The copyright of the content on this website is held by the contributing authors, except where stated elsewhere. See Copyright Statement. Creative Commons License    Legal Imprint    Privacy Policy