Patches are constructed via patch_make() and applied using patch_apply().
Value
patch_make() returns a string representation of the patch(es).
patch_apply()returns the patched version of the stringx, thematchesattribute contains logical values indicating which patches were successfully applied.
Examples
(p = patch_make("abcdef", "abchij"))
#> [1] "@@ -1,6 +1,6 @@\n abc\n-def\n+hij\n"
patch_apply("abcdef", p)
#> [1] "abchij"
#> attr(,"matches")
#> [1] TRUE
patch_apply("abc", p)
#> [1] "abchij"
#> attr(,"matches")
#> [1] TRUE
patch_apply("def", p)
#> [1] "hij"
#> attr(,"matches")
#> [1] TRUE
patch_apply("hij", p)
#> [1] "hij"
#> attr(,"matches")
#> [1] FALSE