Java String Left left(String s, int size)

Here you can find the source of left(String s, int size)

Description

Basic-like Left$ function.

License

Open Source License

Parameter

Parameter Description
s the string to be segmented
size the size of the left segment to be returned

Return

the size-most left characters.

Declaration

public static String left(String s, int size) 

Method Source Code

//package com.java2s;

public class Main {
    /**//from  w ww.j av  a2 s  .c o m
     * Basic-like Left$ function.
     * @param s the string to be segmented
     * @param size the size of the left segment to be returned
     * @return the size-most left characters.
     */
    public static String left(String s, int size) {
        return s.substring(0, Math.min(size, s.length()));
    }
}

Related

  1. left(Object src, int length, String defaultValue)
  2. left(String baseString, int pos)
  3. left(String s, int l)
  4. left(String s, int len)
  5. left(String s, int nCaratteri)
  6. left(String s, int width)
  7. left(String source, int length)
  8. left(String source, String searchFor)
  9. left(String source, String searchFor)