Skip to content

Commit 7ff5460

Browse files
committed
Replace NAs in str_view
Fixes #217
1 parent b2ff220 commit 7ff5460

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

NEWS.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
# stringr 1.3.0.9000
22

3+
* `str_view()` handles `NA` values more gracefully (#217)
4+
35
* `str_replace_all()` with a named vector now respects modifier functions (#207)
46

57
* `str_trunc()` is once again vectorised correctly (#203, @austin3dickey).

R/view.R

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ str_view <- function(string, pattern, match = NA) {
3636
str_sub(string[has_match], loc[has_match, , drop = FALSE]) <-
3737
paste0("<span class='match'>", str_sub(string[has_match], loc[has_match, , drop = FALSE]), "</span>")
3838

39+
string <- str_replace_na(string)
3940
bullets <- htmltools::HTML(str_c(
4041
"<ul>\n",
4142
str_c(" <li>", string, "</li>", collapse = "\n"),

0 commit comments

Comments
 (0)