pos.char: Position of a given character in a string variable (first match)
Description
Determines the position(s) of a given character in a string variable. If the character is absent, NA is returned.
Usage
pos.char(string, char)
Arguments
string
Character string
char
The character to position of which needs to be determined
Value
Details
The function converts the string to a vector of characters. An alternative is to use which(strsplit(string, '')[[1]]=='a'), where a is the character. That code determines all positions of the character in the character string.