Here you can find the source of clip(final String s, final int leftClip, final int rightClip)
Parameter | Description |
---|---|
s | the string to trim |
leftClip | the number of characters off the left to trim |
rightClip | the number of characters off the right to trim |
public static String clip(final String s, final int leftClip, final int rightClip)
//package com.java2s; public class Main { /**// w w w .j a v a 2 s.c om * Trims characters off the start and end of a string * @param s the string to trim * @param leftClip the number of characters off the left to trim * @param rightClip the number of characters off the right to trim * @return the trimmed string */ public static String clip(final String s, final int leftClip, final int rightClip) { return leftClip + rightClip >= s.length() ? "" : s.substring(leftClip, s.length() - rightClip); } }