strs_expandtabs: Expand tabs in a string to spaces

View source: R/expandtabs.R

strs_expandtabsR Documentation

Expand tabs in a string to spaces

Description

strs_expandtabs replaces each tab character (⁠\\t⁠) in a string with a specified number of spaces. This function behaves similarly to Python's str.expandtabs() method.

Usage

strs_expandtabs(string, tabsize = 8)

Arguments

string

A character vector where each element is a string in which to expand tabs.

tabsize

An integer specifying the number of spaces to replace each tab character with. Defaults to 8.

Value

A character vector of the same length as string, with tabs in each element replaced by tabsize number of spaces.

See Also

Python str.expandtabs() documentation

Examples

strs_expandtabs("hello\tworld", 4)
strs_expandtabs("one\ttwo\tthree", 8)

strs documentation built on Sept. 11, 2024, 6:44 p.m.