Java Integer Clamp clampString(String string, int limit)

Here you can find the source of clampString(String string, int limit)

Description

clamp String

License

Open Source License

Declaration

public static String clampString(String string, int limit) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String clampString(String string, int limit) {
        return string.substring(0, string.length() > limit ? limit : string.length());
    }/*from   w w  w  .  j  a va 2  s . c o m*/
}

Related

  1. clampLoop(int v, int min, int max)
  2. clampMono(int value)
  3. clampNonNegative(int i, int a, int b)
  4. clampPower(int num)
  5. clampRGB(int val)
  6. clampTo_0_255(int i)
  7. clampToByte(int c)
  8. clampToByteSize(int value)
  9. clampToShort(int x)