Inaccuracy in documentation of ansi_substr
The documentation for ansi_substr states "works exactly like the original"
but this is not true because it can't be used as a replacement function
like base::substr. It would be nice to have this implemented.
> packageVersion('cli')
[1] '3.6.5'
> x = '1234567890'
> base::substr(x,3,5)
[1] "345"
> base::substr(x,3,5) = 'ABC'
> x
[1] "12ABC67890"
> cli::ansi_substr(x,3,5)
<cli_ansi_string>
[1] ABC
# But try as replacement:
> cli::ansi_substr(x,3,5) = 'XYZ'
Error: 'ansi_substr<-' is not an exported object from 'namespace:cli'
1 条评论