public abstract class StringReplace extends Object implements Lang.Func4<char[],char[],char[],Integer,char[]>
Base class for implementing algorithm that perform replacement on char[]
Modifier and Type | Class and Description |
---|---|
static class |
StringReplace.SimpleStringReplace |
Constructor and Description |
---|
StringReplace() |
Modifier and Type | Method and Description |
---|---|
char[] |
apply(char[] text,
char[] target,
char[] replacement,
Integer firstId)
Apply the function to replace all target in text with replacement and return a
char[] contains the result with all target replaced with replacement |
abstract char[] |
replace(char[] text,
char[] target,
char[] replacement,
int firstId)
Sub class shall implement the replacement logic in this method
|
static StringReplace |
wrap(Lang.Func4<char[],char[],char[],Integer,char[]> replaceLogic) |
public final char[] apply(char[] text, char[] target, char[] replacement, Integer firstId) throws NotAppliedException, Lang.Break
Apply the function to replace all target in text with replacement and return a char[]
contains the result with all target replaced with replacement
apply
in interface Lang.Func4<char[],char[],char[],Integer,char[]>
text
- the texttarget
- the target to searchreplacement
- the replacement of targetfirstId
- the first index of targe inside text. If negative means not searched yetNotAppliedException
$.Break
Lang.Break
- to short cut collecting operations (fold/reduce) on an container
public abstract char[] replace(char[] text, char[] target, char[] replacement, int firstId)
Sub class shall implement the replacement logic in this method
text
- the text in which search string will be replacedtarget
- the target string to be replacedreplacement
- the replacement stringfirstId
- the first index of targe inside text. If negative means not searched yetpublic static StringReplace wrap(Lang.Func4<char[],char[],char[],Integer,char[]> replaceLogic)
Copyright © 2014–2018 OSGL (Open Source General Library). All rights reserved.