Apache OpenOffice (AOO) Bugzilla – Issue 97002
bug in replace() function
Last modified: 2016-04-19 07:48:43 UTC
Replace function work incorrectly when replaced fragment comes in source string more then once. sub main msgbox replace("s p a c e s "," ","") ' "sp ce " msgbox replace("12223","2","xx") ' "1xxxx23" end sum
Andreas, seems to be core BASIC, please have a look ...
.
ab->pflin: If I remember correctly you implemented the replace function. As a reward ;-) you now also get the related issues. Please have a look. We could integrate the fix into cws ab61.
I will have a look
Created attachment 59163 [details] patch to fix this issue
pflin -> ab, please have a look at the patch. if OK, please help commit into your cws ab61
seems this issue has been fixed since m37. It seems I have merged the patch into cws pflin10. Need to verify.
Adding myself to CC as I got no notifications for this issues after assigning it to pflin
Replace function work incorrectly AOO 3.4 Spanish version in Windows Vista Example Sub Main dim s as string, c as string s = "SbxOBJECT addMetadataFile ( SbxSTRING, SbxARRAY )" c = replace( s, "Sbx", "" ) msgbox c End Sub result: "OBJECT addMetadataFile ( SbxSTRING, SbxARRAY )" Regards
(In reply to comment #9) > Replace function work incorrectly AOO 3.4 Spanish version in Windows Vista > > Example > > Sub Main > dim s as string, c as string > s = "SbxOBJECT addMetadataFile ( SbxSTRING, SbxARRAY )" > c = replace( s, "Sbx", "" ) > msgbox c > End Sub > > result: "OBJECT addMetadataFile ( SbxSTRING, SbxARRAY )" > > Regards I couldn't find this function documented in the Online Help nor in the wiki Basic Guide.
replace runtime function was introduced for compatibility with VBA by issue 85035. But it can be called without VBASupport on.
(In reply to comment #11) > replace runtime function was introduced for compatibility with VBA by issue > 85035. > But it can be called without VBASupport on. Do you mean by setting Option Compatible on the module? or by some option in the Tools dialog?
(In reply to comment #12) > (In reply to comment #11) > > replace runtime function was introduced for compatibility with VBA by issue > > 85035. > > But it can be called without VBASupport on. > > Do you mean by setting Option Compatible on the module? or by some option in > the Tools dialog? I needed to say, Option VBASupport 1 is not required to call replace runtime function. It works without loading Tools library. Other functions introduced for compatibility reason like FormatDateTime, Round, InStrRev and StrReverse requires it on.
(In reply to comment #13) > > Do you mean by setting Option Compatible on the module? or by some option in > > the Tools dialog? > I needed to say, Option VBASupport 1 is not required to call replace runtime > function. It works without loading Tools library. > Other functions introduced for compatibility reason like FormatDateTime, > Round, InStrRev and StrReverse requires it on. I see, then besides the bug that it does not work, there is the bug that it is not documented on the Online Help. If I understood clearly, this is now a function of OO Basic Runtime Library, and so it should be documented as such.
*** Issue 97001 has been marked as a duplicate of this issue. ***
The test cases here work. This must have been fixed in #94895. Resolving duplicate. *** This issue has been marked as a duplicate of issue 94895 ***