Top Description Fields Constructors Methods
com.univocity.parsers.conversions

public Class TrimConversion

extends Object
implements Conversion<String, String>
Class Inheritance
All Implemented Interfaces
com.univocity.parsers.conversions.Conversion

Removes leading and trailing white spaces from an input String The TrimConversion#revert(String) implements the same behavior of TrimConversion#execute(String). Null inputs produce null outputs.
Author
Univocity Software Pty Ltd - [email protected]

Field Summary

Modifier and TypeField and Description
private final int

Constructor Summary

AccessConstructor and Description
public
TrimConversion()

Creates a trim conversion that removes leading and trailing whitespaces of any input String.

public
TrimConversion(int
the maximum number of characters of any String returned by this conversion.
length
)

Creates a trim-to-length conversion that limits the length of any resulting String.

Method Summary

Modifier and TypeMethod and Description
public String

Returns:

the input String without leading and trailing white spaces, or null if the input is null.
execute
(String
the String to be trimmed
input
)

Implements com.univocity.parsers.conversions.Conversion.execute.

Removes leading and trailing white spaces from the input and returns the result.
public String

Returns:

the input String without leading and trailing white spaces, or null if the input is null.
revert
(String
the String to be trimmed
input
)

Implements com.univocity.parsers.conversions.Conversion.revert.

Removes leading and trailing white spaces from the input and returns the result.
Inherited from java.lang.Object:
cloneequalsfinalizegetClasshashCodenotifynotifyAlltoStringwaitwaitwait

Field Detail

lengthback to summary
private final int length

Constructor Detail

TrimConversionback to summary
public TrimConversion()

Creates a trim conversion that removes leading and trailing whitespaces of any input String.

TrimConversionback to summary
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:int

the maximum number of characters of any String returned by this conversion.

Method Detail

executeback to summary
public String execute(String input)

Implements com.univocity.parsers.conversions.Conversion.execute.

Removes leading and trailing white spaces from the input and returns the result. Equivalent to TrimConversion#revert(String)

Parameters
input:String

the String to be trimmed

Returns:String

the input String without leading and trailing white spaces, or null if the input is null.

Annotations
@Override
revertback to summary
public String revert(String input)

Implements com.univocity.parsers.conversions.Conversion.revert.

Removes leading and trailing white spaces from the input and returns the result. Equivalent to TrimConversion#execute(String)

Parameters
input:String

the String to be trimmed

Returns:String

the input String without leading and trailing white spaces, or null if the input is null.

Annotations
@Override