processString: Process a String

View source: R/RcppExports.R

processStringR Documentation

Process a String

Description

Processes a given input string by applying optional trimming, case conversion, and ASCII transliteration.

Usage

processString(input, processor = TRUE, asciify = FALSE)

Arguments

input

A std::string representing the input string to be processed.

processor

A bool indicating whether to trim whitespace and convert the string to lowercase. Default is true.

asciify

A bool indicating whether to transliterate non-ASCII characters to their closest ASCII equivalents. Default is false.

Details

The function applies the following transformations to the input string, in this order:

  • Trimming (if processor = TRUE): Removes leading and trailing whitespace.

  • Lowercasing (if processor = TRUE): Converts all characters to lowercase.

  • ASCII Transliteration (if asciify = TRUE): Replaces accented or special characters with their closest ASCII equivalents.

Value

A std::string representing the processed string.

Examples

# Example usage
processString("  Éxâmple!  ", processor = TRUE, asciify = TRUE)
# Returns: "example!"

processString("  Éxâmple!  ", processor = TRUE, asciify = FALSE)
# Returns: "éxâmple!"

processString("  Éxâmple!  ", processor = FALSE, asciify = TRUE)
# Returns: "Éxâmple!"

processString("  Éxâmple!  ", processor = FALSE, asciify = FALSE)
# Returns: "  Éxâmple!  "

RapidFuzz documentation built on April 3, 2025, 11:52 p.m.