Java String Camel Case To camelCaseToDashSeperated(String s)

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

Description

camel Case To Dash Seperated

License

Open Source License

Declaration

public static String camelCaseToDashSeperated(String s) 

Method Source Code

//package com.java2s;
/*//from   w  ww .j  av  a2s  .co  m
 * WAVE - Web Application Visual Environment
 * A Graphical Modeling Framework (GMF) Plugin for Eclipse
 * Copyright Jens Gulden, 2009, mail@jensgulden.de
 * Licensed under the GNU General Public License (GPL)
 */

public class Main {
    public static String camelCaseToDashSeperated(String s) {
        int len = s.length();
        int pos = 1;
        while (pos < len) {
            if (Character.isUpperCase(s.charAt(pos))) {
                String firstword = s.substring(0, pos).toLowerCase();
                String rest = camelCaseToDashSeperated(s.substring(pos)); // recursion
                return firstword + "-" + rest;
            }
            pos++;
        }
        return s.toLowerCase();
    }
}

Related

  1. camelCasePrefix(String strPrefix)
  2. camelCaseSpace(final String str)
  3. camelCaseToDash(String input)
  4. camelCaseToDashes(String camelCaseString, int startIndex, String prefix)
  5. camelCaseToDashLowerName(String name)
  6. camelCaseToDotNotation(String string)
  7. camelCaseToEnum(String camelCase)
  8. camelCaseToEnum(String name)
  9. camelCaseToHuman(String input)