hasChar {tkWidgets} | R Documentation |
String Prefix and Suffix Checking
Description
These functions return a function for determining if a given prefix, suffix, or set of characters passed to this function exists in a character string passed to the returned function.
Usage
hasChar(toCheck, what = "")
hasPrefix(aPrefix)
hasSuffix(aSuffix)
Arguments
aPrefix |
character string to be used as the prefix to be checked for |
aSuffix |
character string to be used as the suffix to be checked for |
toCheck |
|
what |
|
Details
The prefix (or suffix) is passed to hasPrefix
(or
hasSuffix
) and then the returned function can be used to check
for the existence of that prefix (suffix) in a string passed to that
function.
hasChar is a more general function that determines the existence of prefix, sufix, or a set of a characters in a character string passed to the returned function.
Value
A function which itself returns a logical (of length 1)
indicating if the prefix/suffix is found (TRUE
) or not.
Author(s)
Jianhua (John) Zhang
See Also
Examples
# Function for checking for a prefix "xxx" :
chkPfun <- hasChar("xxx", what = "prefix")
# Function for checking for a suffix ".tex" :
chkSfun <- hasChar(".tex", what = "suffix")
chkPfun("xxx.tex")
chkPfun(".xxx")
chkSfun("xxx.tex")
chkSfun("yyyyy")
chkSfun("yxxx.text")