You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'
Activity
gaborcsardi commentedon Jun 23, 2025
ansi_substr<-()is a different function fromansi_substr().