powered by
This function is similar to base::trimws() but works on ANSI strings, and keeps color and other styling.
base::trimws()
ansi_trimws(x, which = c("both", "left", "right"))
ANSI string, with the whitespace removed.
ANSI string vector.
Whether to remove leading or trailing whitespace or both.
Other ANSI string operations: ansi_align(), ansi_columns(), ansi_nchar(), ansi_strsplit(), ansi_strtrim(), ansi_strwrap(), ansi_substr(), ansi_substring(), ansi_toupper()
ansi_align()
ansi_columns()
ansi_nchar()
ansi_strsplit()
ansi_strtrim()
ansi_strwrap()
ansi_substr()
ansi_substring()
ansi_toupper()
trimws(paste0(" ", col_red("I am red"), " ")) ansi_trimws(paste0(" ", col_red("I am red"), " ")) trimws(col_red(" I am red ")) ansi_trimws(col_red(" I am red "))
Run the code above in your browser using DataLab