Here you can find the source of camelCaseToDashSeperated(String s)
public static String camelCaseToDashSeperated(String s)
//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(); } }