Java String Sub String subString(String str, int offset, int leng)

Here you can find the source of subString(String str, int offset, int leng)

Description

sub String

License

Open Source License

Declaration


public static String subString(String str, int offset, int leng) 

Method Source Code

//package com.java2s;
/*/*w w  w  .  ja  va  2  s  .c  om*/
 *  ?????? : ???? ???? ??? ??
 *  ??? : MOB ??? ???
 *
 *  Copyright 2007 by Digital Solution Center, Samsung Electronics, Inc.,
 *   All rights reserved.
 *
 *  This software is the confidential and proprietary information
 *  of Samsung Electronics, Inc. ("Confidential Information").  You
 *  shall not disclose such Confidential Information and shall use
 *  it only in accordance with the terms of the license agreement
 *  you entered into with Samsung.
 *
 *
 */

public class Main {

    public static String subString(String str, int offset, int leng) {
        return new String(str.getBytes(), (offset - 1), leng);
    }

    public static String subString(String str, int offset) {
        byte[] bytes = str.getBytes();
        int size = bytes.length - (offset - 1);
        return new String(bytes, (offset - 1), size);
    }
}

Related

  1. substring(String str, int index, int length)
  2. subString(String str, int len)
  3. substring(String str, int len)
  4. subString(String str, int num, String token)
  5. substring(String str, int off, int len)
  6. substring(String str, int start)
  7. substring(String str, int start)
  8. substring(String str, int start)
  9. substring(String str, int start, int end)