Created
September 2, 2021 10:15
-
-
Save arslan-gg/28dca48fcd4ca303fb6c75d81cea22b2 to your computer and use it in GitHub Desktop.
Trim string value in Java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public String trim(String value, int maxLength) { | |
return value.substring(0, Math.min(value.length(), maxLength)); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment