initialChar: Convert the first letter that occurs in a string to lower...

View source: R/initialChar.R

initialCharR Documentation

Convert the first letter that occurs in a string to lower case

Description

By default, initialChar finds the first letter that occurs in a string and returns its lower case version. The user may use the "adm" argument to restrict the admissable letters which may be returned (by default this will be all possible lower case letters).

Usage

initialChar(txt, adm = "[:lower:]", err = "Not acceptable value")

Arguments

txt

(Required) The string input to process

adm

(Optional) Regular expression which may be used to restrict the set of letters which will be returned. By default it will allow all lower case letters

err

(Optional) The error message which will be printed if no admissable letters (as determined by adm) are found. By default, message "Not acceptable value" will be displayed

Value

initalChar returns a lower case version of the first letter contained in the string "txt" if that character is admissable. If it is not (or no letter is found), an error message will be printed.

Note

This function is not case sensitive.

Author(s)

Romain Francois

Examples


initialChar("100 Kilometers")
## Not run: 
   # The first character is "A", but "a" is not in the list of admissable letters
    initialChar("Allen, Alistair, Atticus", adm = "irt" )
  
## End(Not run)


MikeKSmith/MSToolkit documentation built on Feb. 15, 2024, 5:32 p.m.