Class StringReplacer

Summary

This class prebuilds some objects to make wholesale substring replacements more efficient. The constructor takes a table mapping strings to their replacements. The method replace(s) then returns a copy of string s with all substrings found in the table with the corresponding replacement string.

StringReplacer is most useful when you have a lot of replacements to perform across a lot of text. For simple cases, the util::replaceStrs procedure is likely to be faster.

Superclasses:
Object

Package:
util
File:
str_replacer.icn
Methods:
replace

Methods inherited from Object:
Type, className, clone, equals, fieldNames, genMethods, getField, get_class, get_class_name, get_id, hasField, hasMethod, hash_code, instanceOf, invoke, is_instance, setField, to_string

Fields:
ff, tbl

Source code.

Details
Constructor

StringReplacer(mapTable)

Construct a StringReplacer based on the string mappings found in mapTable.

Methods:

replace(s)

Returns:
a copy of s with substrings replaced

Perform substring replacement on the string s


Fields:
ff

tbl


This page produced by UniDoc on 2021/04/15 @ 23:59:54.