File: checkString.R

package info (click to toggle)
r-cran-checkmate 2.3.4-1
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 1,512 kB
  • sloc: ansic: 2,211; sh: 9; makefile: 8
file content (52 lines) | stat: -rw-r--r-- 1,381 bytes parent folder | download | duplicates (2)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
#' Check if an argument is a string
#'
#' @description
#' A string is defined as a scalar character vector.
#' To check for vectors of arbitrary length, see \code{\link{checkCharacter}}.
#'
#' @templateVar fn String
#' @template x
#' @template na-handling
#' @template na.ok
#' @inheritParams checkCharacter
#' @template null.ok
#' @template checker
#' @family scalars
#' @export
#' @useDynLib checkmate c_check_string
#' @examples
#' testString("a")
#' testString(letters)
checkString = function(x, na.ok = FALSE, n.chars = NULL, min.chars = NULL, max.chars = NULL, pattern = NULL, fixed = NULL, ignore.case = FALSE, null.ok = FALSE) {
  .Call(c_check_string, x, na.ok, n.chars, min.chars, max.chars, null.ok) %and%
    checkCharacterPattern(x, pattern, fixed, ignore.case)
}

#' @export
#' @rdname checkString
check_string = checkString

#' @export
#' @include makeAssertion.R
#' @template assert
#' @rdname checkString
assertString = makeAssertionFunction(checkString, use.namespace = FALSE)

#' @export
#' @rdname checkString
assert_string = assertString

#' @export
#' @include makeTest.R
#' @rdname checkString
testString = makeTestFunction(checkString)

#' @export
#' @rdname checkString
test_string = testString

#' @export
#' @include makeExpectation.R
#' @template expect
#' @rdname checkString
expect_string = makeExpectationFunction(checkString, use.namespace = FALSE)