highlight: Highlight differences between strings.

Description Usage Arguments Details Value Examples

Description

Add a prefix and a suffix to all the substrings that are different between a vector of source strings, and a target string.

Usage

1
highlight(source, target, affixes)

Arguments

source

[character] A vector of strings to be highlighted.

target

[character] A string to which source strings are to be compared.

affixes

[character] A vector of two strings: the first to be prepended to highlighted bits, and the second to be appended to them.

Details

The effect is similar to Unix diff, only all the differences are highlighted in the same colour, and a "_" is inerted where characters are missing. To save on speed, the function does not check the arguments are correct, etc.

Value

[character] The highlighted strings.

Examples

1
cat (soundcorrs:::highlight (c("kitten","mitten"), "sitting", c("\u001b[31m","\u001b[0m")))

soundcorrs documentation built on Nov. 16, 2020, 5:09 p.m.