Top Inners Fields Constructors Methods
org.apache.poi.ss.formula.functions

public abstract Class TextFunction

extends Object
implements Function
Class Inheritance
All Implemented Interfaces
org.apache.poi.ss.formula.functions.Function
Imports
java.util.Locale, org.apache.poi.ss.formula.eval.AreaEval, .BlankEval, .BoolEval, .ErrorEval, .EvaluationException, .NumberEval, .NumericValueEval, .OperandResolver, .StringEval, .StringValueEval, .ValueEval, org.apache.poi.ss.usermodel.DataFormatter, .DateUtil

Nested and Inner Type Summary

Modifier and TypeClass and Description
private static class
private static class
private abstract static class

Field Summary

Modifier and TypeField and Description
public static final Function
CHAR

Returns the character specified by a number.

public static final Function
CLEAN

An implementation of the CLEAN function: In Excel, the Clean function removes all non-printable characters from a string.

public static final FreeRefFunction
public static final Function
public static final Function
public static final Function
FIND

Implementation of the FIND() function.

protected static final DataFormatter
public static final Function
public static final Function
public static final Function
public static final Function
MID

An implementation of the MID function MID returns a specific number of characters from a text string, starting at the specified position.

public static final Function
PROPER

Implementation of the PROPER function: Normalizes all words (separated by non-word characters) by making the first letter upper and the rest lower case.

public static final Function
public static final Function
SEARCH

Implementation of the FIND() function.

public static final Function
TEXT

An implementation of the TEXT function TEXT returns a number value formatted with the given number formatting string.

public static final Function
TRIM

An implementation of the TRIM function: Removes leading and trailing spaces from value if evaluated operand value is string.

public static final Function

Constructor Summary

AccessConstructor and Description
public

Method Summary

Modifier and TypeMethod and Description
public final ValueEval
evaluate(ValueEval[]
the evaluated function arguments. Empty values are represented with BlankEval or MissingArgEval, never null.
args
,
int
row index of the cell containing the formula under evaluation
srcCellRow
,
int
column index of the cell containing the formula under evaluation
srcCellCol
)

Implements org.apache.poi.ss.formula.functions.Function.evaluate.

protected static double
evaluateDoubleArg(ValueEval arg, int srcCellRow, int srcCellCol)

protected abstract ValueEval
evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol)

protected static int
evaluateIntArg(ValueEval arg, int srcCellRow, int srcCellCol)

protected static String
evaluateStringArg(ValueEval eval, int srcRow, int srcCol)

Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

CHARback to summary
public static final Function CHAR

Returns the character specified by a number.

CLEANback to summary
public static final Function CLEAN

An implementation of the CLEAN function: In Excel, the Clean function removes all non-printable characters from a string. Author: Aniket Banerjee([email protected])

CONCATback to summary
public static final FreeRefFunction CONCAT
CONCATENATEback to summary
public static final Function CONCATENATE
EXACTback to summary
public static final Function EXACT
FINDback to summary
public static final Function FIND

Implementation of the FIND() function.

Syntax:
FIND(find_text, within_text, start_num)

FIND returns the character position of the first (case sensitive) occurrence of find_text inside within_text. The third parameter, start_num, is optional (default=1) and specifies where to start searching from. Character positions are 1-based.

Author: Torstein Tauno Svendsen ([email protected])

formatterback to summary
protected static final DataFormatter formatter
LEFTback to summary
public static final Function LEFT
LENback to summary
public static final Function LEN
LOWERback to summary
public static final Function LOWER
MIDback to summary
public static final Function MID

An implementation of the MID function
MID returns a specific number of characters from a text string, starting at the specified position.

Syntax:
MID(text, start_num, num_chars)
Author: Manda Wilson < wilson at c bio dot msk cc dot org >

PROPERback to summary
public static final Function PROPER

Implementation of the PROPER function: Normalizes all words (separated by non-word characters) by making the first letter upper and the rest lower case. This is nearly equivalent to toTitleCase if the Java language had it

TEXTback to summary
public static final Function TEXT

An implementation of the TEXT function
TEXT returns a number value formatted with the given number formatting string. This function is not a complete implementation of the Excel function, but handles most of the common cases. All work is passed down to DataFormatter to be done, as this works much the same as the display focused work that that does. Syntax:
TEXT(value, format_text)

TRIMback to summary
public static final Function TRIM

An implementation of the TRIM function: Removes leading and trailing spaces from value if evaluated operand value is string. Since POI 5.1.0, this also trims double spaces so that only 1 is kept (https://bz.apache.org/bugzilla/show_bug.cgi?id=65230). Author: Manda Wilson < wilson at c bio dot msk cc dot org >

UPPERback to summary
public static final Function UPPER

Constructor Detail

TextFunctionback to summary
public TextFunction()

Method Detail

evaluateback to summary
public final ValueEval evaluate(ValueEval[] args, int srcCellRow, int srcCellCol)

Implements org.apache.poi.ss.formula.functions.Function.evaluate.

Parameters
args:ValueEval[]

Doc from org.apache.poi.ss.formula.functions.Function.evaluate.

the evaluated function arguments. Empty values are represented with BlankEval or MissingArgEval, never null.

srcCellRow:int

Doc from org.apache.poi.ss.formula.functions.Function.evaluate.

row index of the cell containing the formula under evaluation

srcCellCol:int

Doc from org.apache.poi.ss.formula.functions.Function.evaluate.

column index of the cell containing the formula under evaluation

Returns:ValueEval

Doc from org.apache.poi.ss.formula.functions.Function.evaluate.

The evaluated result, possibly an ErrorEval, never null

Note

- Excel uses the error code #NUM! instead of IEEE NaN, so when numeric functions evaluate to Double#NaN be sure to translate the result to ErrorEval#NUM_ERROR.

Annotations
@Override
evaluateDoubleArgback to summary
protected static double evaluateDoubleArg(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException
evaluateFuncback to summary
protected abstract ValueEval evaluateFunc(ValueEval[] args, int srcCellRow, int srcCellCol) throws EvaluationException
evaluateIntArgback to summary
protected static int evaluateIntArg(ValueEval arg, int srcCellRow, int srcCellCol) throws EvaluationException
evaluateStringArgback to summary
protected static String evaluateStringArg(ValueEval eval, int srcRow, int srcCol) throws EvaluationException
org.apache.poi.ss.formula.functions back to summary

private final Class TextFunction.LeftRight

extends Var1or2ArgFunction
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final boolean
private static final ValueEval

Constructor Summary

AccessConstructor and Description
protected
LeftRight(boolean isLeft)

Method Summary

Modifier and TypeMethod and Description
public ValueEval
public ValueEval
Inherited from org.apache.poi.ss.formula.functions.Var1or2ArgFunction:
evaluate

Field Detail

_isLeftback to summary
private final boolean _isLeft
DEFAULT_ARG1back to summary
private static final ValueEval DEFAULT_ARG1

Constructor Detail

LeftRightback to summary
protected LeftRight(boolean isLeft)

Method Detail

evaluateback to summary
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0)

Implements org.apache.poi.ss.formula.functions.Function1Arg.evaluate.

Doc from org.apache.poi.ss.formula.functions.Function1Arg.evaluate.

see Function#evaluate(ValueEval[], int, int)

Annotations
@Override
evaluateback to summary
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1)

Implements org.apache.poi.ss.formula.functions.Function2Arg.evaluate.

Doc from org.apache.poi.ss.formula.functions.Function2Arg.evaluate.

see Function#evaluate(ValueEval[], int, int)

Annotations
@Override
org.apache.poi.ss.formula.functions back to summary

private final Class TextFunction.SearchFind

extends Var2or3ArgFunction
Class Inheritance

Field Summary

Modifier and TypeField and Description
private final boolean

Constructor Summary

AccessConstructor and Description
public
SearchFind(boolean isCaseSensitive)

Method Summary

Modifier and TypeMethod and Description
private ValueEval
eval(String haystack, String needle, int startIndex)

public ValueEval
public ValueEval
Inherited from org.apache.poi.ss.formula.functions.Var2or3ArgFunction:
evaluate

Field Detail

_isCaseSensitiveback to summary
private final boolean _isCaseSensitive

Constructor Detail

SearchFindback to summary
public SearchFind(boolean isCaseSensitive)

Method Detail

evalback to summary
private ValueEval eval(String haystack, String needle, int startIndex)
evaluateback to summary
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1)

Implements org.apache.poi.ss.formula.functions.Function2Arg.evaluate.

Doc from org.apache.poi.ss.formula.functions.Function2Arg.evaluate.

see Function#evaluate(ValueEval[], int, int)

Annotations
@Override
evaluateback to summary
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0, ValueEval arg1, ValueEval arg2)

Implements org.apache.poi.ss.formula.functions.Function3Arg.evaluate.

Doc from org.apache.poi.ss.formula.functions.Function3Arg.evaluate.

see Function#evaluate(ValueEval[], int, int)

Annotations
@Override
org.apache.poi.ss.formula.functions back to summary

private abstract Class TextFunction.SingleArgTextFunc

extends Fixed1ArgFunction
Class Inheritance

Constructor Summary

AccessConstructor and Description
protected

Method Summary

Modifier and TypeMethod and Description
public ValueEval
protected abstract ValueEval
Inherited from org.apache.poi.ss.formula.functions.Fixed1ArgFunction:
evaluate

Constructor Detail

SingleArgTextFuncback to summary
protected SingleArgTextFunc()

Method Detail

evaluateback to summary
public ValueEval evaluate(int srcRowIndex, int srcColumnIndex, ValueEval arg0)

Implements org.apache.poi.ss.formula.functions.Function1Arg.evaluate.

Doc from org.apache.poi.ss.formula.functions.Function1Arg.evaluate.

see Function#evaluate(ValueEval[], int, int)

Annotations
@Override
evaluateback to summary
protected abstract ValueEval evaluate(String arg)