Learn R Programming

forstringr (version 1.0.0)

str_mid: Returns a segment of character strings

Description

str_mid() returns a specific number of characters from a text string, starting at the position you specify, based on the number of characters you specify.

Usage

str_mid(string, start, n)

Value

A character vector.

Arguments

string

The text string containing the characters you want to extract.

start

The position of the first character you want to extract in the text. The first character in text has start = 1, and so on.

n

The length of character to extract.

See Also

str_left() which extracts characters from the left and str_right() which extracts characters from the right.

Examples

Run this code
str_mid("Super Eagle", 7, 5)

str_mid("Oyo Ibadan", 5, 6)

Run the code above in your browser using DataLab