Write code to Convert camel Case To Dash with for loop
//package com.book2s; public class Main { public static void main(String[] argv) { String value = "AbcDef"; System.out.println(camelCaseToDash(value)); }// w ww .jav a2 s . c o m public static String camelCaseToDash(String value) { StringBuilder sb = new StringBuilder(value.length()); boolean dash = false; for (char c : value.toCharArray()) { if (Character.isUpperCase(c)) { dash = true; } if (dash) { sb.append('-'); sb.append(Character.toLowerCase(c)); } else { sb.append(c); } dash = false; } return sb.toString(); } }