Class TrimConversion
- java.lang.Object
-
- com.univocity.parsers.conversions.TrimConversion
-
- All Implemented Interfaces:
Conversion<java.lang.String,java.lang.String>
public class TrimConversion extends java.lang.Object implements Conversion<java.lang.String,java.lang.String>
Removes leading and trailing white spaces from an input String Therevert(String)
implements the same behavior ofexecute(String)
. Null inputs produce null outputs.
-
-
Field Summary
Fields Modifier and Type Field Description private int
length
-
Constructor Summary
Constructors Constructor Description TrimConversion()
Creates a trim conversion that removes leading and trailing whitespaces of any input String.TrimConversion(int length)
Creates a trim-to-length conversion that limits the length of any resulting String.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description java.lang.String
execute(java.lang.String input)
Removes leading and trailing white spaces from the input and returns the result.java.lang.String
revert(java.lang.String input)
Removes leading and trailing white spaces from the input and returns the result.
-
-
-
Constructor Detail
-
TrimConversion
public TrimConversion()
Creates a trim conversion that removes leading and trailing whitespaces of any input String.
-
TrimConversion
public TrimConversion(int length)
Creates a trim-to-length conversion that limits the length of any resulting String. Input Strings are trimmed, and if the resulting String has more characters than the given limit, any characters over the given limit will be discarded.- Parameters:
length
- the maximum number of characters of any String returned by this conversion.
-
-
Method Detail
-
execute
public java.lang.String execute(java.lang.String input)
Removes leading and trailing white spaces from the input and returns the result. Equivalent torevert(String)
- Specified by:
execute
in interfaceConversion<java.lang.String,java.lang.String>
- Parameters:
input
- the String to be trimmed- Returns:
- the input String without leading and trailing white spaces, or null if the input is null.
-
revert
public java.lang.String revert(java.lang.String input)
Removes leading and trailing white spaces from the input and returns the result. Equivalent toexecute(String)
- Specified by:
revert
in interfaceConversion<java.lang.String,java.lang.String>
- Parameters:
input
- the String to be trimmed- Returns:
- the input String without leading and trailing white spaces, or null if the input is null.
-
-