countSpaces {HLAtools}R Documentation

Count the Spaces in a Character String

Description

Counts the number of spaces in a character string.

Usage

countSpaces(x)

Arguments

x

A character string.

Value

A vector of numeric values identifying the number of instances of spaces (' ') in x, and the number of consecutive spaces in an instance.

Author(s)

Josh Bredeweg, Reddit user jbraids1421

Source

https://www.reddit.com/r/rstats/comments/2th8ic/function_to_count_the_number_of_white_spaces/

Examples

countSpaces("abc def")
countSpaces("abc def  ghi   jkl mno")


[Package HLAtools version 1.6.2 Index]