StringTruncate

See javadoc - uk.gov.gchq.koryphe.impl.function.StringTruncate

Available since Koryphe version 1.9.0

Truncates a string, with optional ellipses.

Examples

With no ellipses

Java
JSON
Full JSON
Python
final StringTruncate function = new StringTruncate(5, false);
{
  "class" : "StringTruncate",
  "length" : 5,
  "ellipses" : false
}
{
  "class" : "uk.gov.gchq.koryphe.impl.function.StringTruncate",
  "length" : 5,
  "ellipses" : false
}
g.StringTruncate( 
  length=5, 
  ellipses=False 
)

Input type:

java.lang.String

Example inputs:

Input TypeInputResult TypeResult
java.lang.Stringno more than fivejava.lang.Stringno mo
java.lang.Stringfourjava.lang.Stringfour
java.lang.Stringjava.lang.String
nullnull
java.lang.Long54ClassCastException: java.lang.Long cannot be cast to java.lang.String

With ellipses

Java
JSON
Full JSON
Python
final StringTruncate function = new StringTruncate(5, true);
{
  "class" : "StringTruncate",
  "length" : 5,
  "ellipses" : true
}
{
  "class" : "uk.gov.gchq.koryphe.impl.function.StringTruncate",
  "length" : 5,
  "ellipses" : true
}
g.StringTruncate( 
  length=5, 
  ellipses=True 
)

Input type:

java.lang.String

Example inputs:

Input TypeInputResult TypeResult
java.lang.Stringno more than fivejava.lang.Stringno mo...
java.lang.Stringfourjava.lang.Stringfour
java.lang.Stringjava.lang.String
nullnull
java.lang.Long54ClassCastException: java.lang.Long cannot be cast to java.lang.String

results matching ""

    No results matching ""