tests/testthat/test-str_mid.R

test_that("str_mid() returns a segment of character strings", {
  expect_equal(str_mid("COVID-19", start = 2, n = 2), "OV")
  expect_equal(str_mid("a,b,c", start = 2, n = 2), ",b")
})

Try the forstringr package in your browser

Any scripts or data that you put into this service are public.

forstringr documentation built on Aug. 7, 2023, 5:08 p.m.