Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
46 commits
Select commit Hold shift + click to select a range
83765f3
Split on sentence and other boundaries
lmullen Feb 24, 2015
05ec27b
Merge branch 'master' of github.com:hadley/stringr
lmullen Oct 30, 2015
ca8d2d5
Use full arg name for rep(length.out=...)
jcheng5 Mar 30, 2015
4150a4d
Update revdep checks
hadley Apr 14, 2015
777a864
Preparing for release
hadley Apr 15, 2015
3b13758
Use cg_missing in str_match too.
hadley Apr 15, 2015
c705285
Summary when returning "" for no match
hadley Apr 15, 2015
c9f617c
Clarify result when optional group doesn't match
hadley Apr 15, 2015
855fd34
Final revdep checks
hadley Apr 28, 2015
d66b875
NO TRAILING PERIOD
hadley Apr 28, 2015
9fe2466
Note about maintainer change. Description fixes
hadley Apr 29, 2015
b62f09e
Use person(), not as.person()
hadley Apr 29, 2015
8ce49e8
Bump version
hadley Apr 30, 2015
05612e7
Upgrade roxygen2
hadley May 4, 2015
e6cb994
Regex, not regexp. Fixes #61
hadley May 4, 2015
8e61e2f
Switch to new travis config
hadley May 4, 2015
f074e68
Typo in vignette
luckyrandom May 6, 2015
b3cefab
Added str_interp for string interpolation.
smbache May 29, 2015
ad8d707
updated roxygen2, added @noRd to internal functions.
smbache May 29, 2015
463c345
Fixed a bug when no placeholder are found in str_interp. Added featur…
smbache May 31, 2015
da263ea
Add URL & BugReports to DESCRIPTION
gaborcsardi Jun 5, 2015
123dab3
str_subset fixed case_insensitive patch
gagolews Jun 7, 2015
5e7fa03
updated stringi man links
gagolews Jun 7, 2015
338f31d
Update man and NEWS.md
gagolews Jun 8, 2015
e935349
Added test for hyphenation feature for string_interp and the case wit…
smbache Jun 9, 2015
70174ca
Disallow nested placeholders for str_interp
smbache Jun 13, 2015
dee4e48
added a few tests for str_interp
smbache Jun 13, 2015
f883c66
add str_wrap tests
gagolews Jun 13, 2015
7e2cd8b
update travis.yml
gagolews Jun 13, 2015
f235fec
#83: no fix_replacement for fixed patters
gagolews Jun 27, 2015
4c544ec
#83 fixed: fix_replacement now generates correct replacement strings
gagolews Jun 27, 2015
dfca331
make str_replace_na example show NA -> "NA" conversion
tjmahr Aug 5, 2015
33f7832
str_view html widget
hadley Oct 27, 2015
c0525f0
Update docs
hadley Oct 27, 2015
fb5cfa1
Correct arg name
hadley Oct 27, 2015
d5c273d
Better way to set height
hadley Oct 27, 2015
6da3584
Upgrade roxygen2
hadley Oct 29, 2015
79e6728
Add match argument to str_view
hadley Oct 29, 2015
44f1b91
Use code coverage
hadley Oct 30, 2015
5581d1f
Add CRAN status badge
hadley Oct 30, 2015
9ea8bd2
Remove useless package docs.
hadley Oct 30, 2015
adfe508
Better documentation for str_c.
hadley Oct 30, 2015
42d513e
Cross-reference str_match from str_extract.
hadley Oct 30, 2015
4180e23
Check that modifiers only applied to bare string.
hadley Oct 30, 2015
4a3b056
Merge branch 'master' of github.com:lmullen/stringr
lmullen Oct 30, 2015
84aba0d
Better handling of `skip_word_none`
lmullen Oct 30, 2015
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@
* `str_replace()` and `str_replace_all()` now behave correctly when a
replacement string contains `$`s, `\\\\1`, etc. (#83, @gagolews).

* `boundary()` has a different default argument which works for splitting on
sentence boundaries (#58, @lmullen).

# stringr 1.0.0

* stringr is now powered by [stringi](https://github.com/Rexamine/stringi)
Expand Down
10 changes: 8 additions & 2 deletions R/modifiers.r
Original file line number Diff line number Diff line change
Expand Up @@ -115,12 +115,18 @@ regex <- function(pattern, ignore_case = FALSE, multiline = FALSE,

#' @param type Boundary type to detect.
#' @param skip_word_none Ignore "words" that don't contain any characters
#' or numbers - i.e. punctuation.
#' or numbers - i.e. punctuation. Default \code{NA} will skip such "words"
#' only when splitting on \code{word} boundaries.
#' @export
#' @rdname modifiers
boundary <- function(type = c("character", "line_break", "sentence", "word"),
skip_word_none = TRUE, ...) {
skip_word_none = NA, ...) {
type <- match.arg(type)

if (identical(skip_word_none, NA)) {
skip_word_none <- type == "word"
}

options <- stri_opts_brkiter(
type = type,
skip_word_none = skip_word_none,
Expand Down
13 changes: 13 additions & 0 deletions tests/testthat/test-split.r
Original file line number Diff line number Diff line change
Expand Up @@ -67,3 +67,16 @@ test_that("n sets exact number of splits in str_split_fixed", {
equals(c("Subject", "Roger: his drinking problems")))

})

test_that("str_split can split sentences correctly", {
test <- "This is a sentence. Is this a sentence? Why, yes it is."

expect_that(
length(str_split(test, boundary("sentence"))[[1]]),
equals(3))
expect_that(
str_split(test, boundary("sentence")),
equals(list(c("This is a sentence. ", "Is this a sentence? ",
"Why, yes it is."))))

})