Learn R Programming

diffmatchpatch (version 0.1.0)

patch_make: Create and apply patches to a text string

Description

Patches are constructed via patch_make() and applied using patch_apply().

Usage

patch_make(x, y)

patch_apply(x, patch)

Arguments

x

The source string

y

The destination string

patch

A string representation of the patch(es).

Value

patch_make() returns a string representation of the patch(es).

  • patch_apply() returns the patched version of the string x, the matches attribute contains logical values indicating which patches were successfully applied.

Examples

Run this code
# NOT RUN {
(p = patch_make("abcdef", "abchij"))

patch_apply("abcdef", p)

patch_apply("abc", p)

patch_apply("def", p)

patch_apply("hij", p)

# }

Run the code above in your browser using DataLab