| Summary: | BASIC: Replace's Start argument needs clarifying | ||
|---|---|---|---|
| Product: | LibreOffice | Reporter: | Mike Kaganski <mikekaganski> |
| Component: | Documentation | Assignee: | Olivier Hallot <olivier.hallot> |
| Status: | RESOLVED FIXED | ||
| Severity: | normal | CC: | himajin100000, olivier.hallot |
| Priority: | medium | ||
| Version: | unspecified | ||
| Hardware: | All | ||
| OS: | All | ||
| Whiteboard: | target:7.0.0 | ||
| Crash report or crash signature: | Regression By: | ||
| Bug Depends on: | |||
| Bug Blocks: | 80430 | ||
While at it, the argument has no limitation (or rather, it's 32-bit signed integer); the limitation of 65535 mentioned in help should be dropped. Olivier Hallot committed a patch related to this issue. It has been pushed to "master": https://git.libreoffice.org/help/commit/45bb570b11740cfca92aebe35ed016916c9ce2d5 tdf#132390 Correction for replace() Basic function |
Replace's Start argument is documented in help [1] as "Numeric expression that indicates the character position within the string where the search shall begin. The maximum allowed value is 65535." But it's not only that; it is also the start of the substring to be returned. This is how it's implemented, and also consistent with analogous VBA function [2]. E.g., Replace("ABCDE", "C", "*", 2) will return "B*DE", starting from the position 2. This needs to be documented in help. [1] https://help.libreoffice.org/6.4/en-US/text/sbasic/shared/replace.html [2] https://docs.microsoft.com/en-us/office/vba/Language/Reference/User-Interface-Help/replace-function