Java String Clone cloneString(final String toClone)

Here you can find the source of cloneString(final String toClone)

Description

clone String

License

Open Source License

Declaration

public static String cloneString(final String toClone) 

Method Source Code

//package com.java2s;

public class Main {
    public static String cloneString(final String toClone) {
        if (toClone == null) {
            return null;
        }/* ww  w. java 2 s.c  om*/
        if (toClone.isEmpty()) {
            return new String("").concat(new String(""));
        }

        if (toClone.length() == 1) {
            return String.valueOf(toClone.charAt(0));
        }

        return toClone.substring(0, 1) + toClone.substring(1);
    }

    public static int length(final String s, final String separator) {
        final String[] list = s.split(separator);
        return list.length;
    }
}

Related

  1. cloneString(String input)
  2. cloneString(String sOriginal)
  3. cloneString(String str)