
com.inamik.text.tables.line.LeftTruncate Maven / Gradle / Ivy
The newest version!
/*
* iNamik Text Tables for Java
*
* Copyright (C) 2016 David Farrell ([email protected])
*
* Licensed under The MIT License (MIT), see LICENSE.txt
*/
package com.inamik.text.tables.line;
import com.inamik.text.tables.line.base.FunctionWithWidth;
public final class LeftTruncate extends FunctionWithWidth
{
public static final LeftTruncate INSTANCE = new LeftTruncate();
@Override
public String apply(Integer width, String line) {
if (line.length() > width) {
return line.substring(line.length() - width);
}
return line;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy