Here you can find the source of decamelize(String s)
Parameter | Description |
---|---|
s | a parameter |
public static String decamelize(String s)
//package com.java2s; //License from project: Open Source License public class Main { /**//from w w w .j av a2 s.c om * * @param s * @return */ public static String decamelize(String s) { if (s == null || s.equals("")) { return s; } StringBuffer buf = new StringBuffer(); buf.append(Character.toLowerCase(s.charAt(0))); for (int i = 1; i < s.length(); i++) { if (Character.isUpperCase(s.charAt(i))) { if (s.length() > i + 1 && Character.isLowerCase(s.charAt(i + 1))) { buf.append("-"); } } buf.append(Character.toLowerCase(s.charAt(i))); } return buf.toString(); } }