Java String Split splitCamelback(String s)

Here you can find the source of splitCamelback(String s)

Description

split Camelback

License

Open Source License

Declaration

public static String[] splitCamelback(String s) 

Method Source Code


//package com.java2s;

import java.util.Arrays;

public class Main {
    public static String[] splitCamelback(String s) {
        return s.split("(?<=[a-z])(?=[A-Z])");
    }//from  ww w  .j  av  a2 s  .c  o  m

    public static String splitCamelback(String s, String sep) {
        return join(Arrays.asList(splitCamelback(s)), sep);
    }

    public static <T> String join(Iterable<T> a, String sep) {
        StringBuilder sb = new StringBuilder();
        int pos = 0;
        for (T i : a) {
            if (pos > 0)
                sb.append(sep);
            sb.append(i);
            ++pos;
        }
        return sb.toString();
    }
}

Related

  1. splitAtLastBlank(String s, int width)
  2. splitAttributes(final String dname)
  3. splitAuthors(String source)
  4. splitBreaks(String text)
  5. splitByTypeAndName(final String s)
  6. splitCQLStatements(String source)
  7. splitDateText(String text)
  8. splitDigits(long input)
  9. splitDomains(String domains)