Here you can find the source of capitalize(String str, String delimiter)
public static String capitalize(String str, String delimiter)
//package com.java2s; /*//from w w w. j ava 2 s . c o m * Scriptographer * * This file is part of Scriptographer, a Scripting Plugin for Adobe Illustrator * http://scriptographer.org/ * * Copyright (c) 2002-2010, Juerg Lehni * http://scratchdisk.com/ * * All rights reserved. See LICENSE file for details. * * File created on 08.12.2006. */ public class Main { public static String capitalize(String str, String delimiter) { String[] parts = str.split("\\s"); StringBuffer res = new StringBuffer(); for (int i = 0, l = parts.length; i < l; i++) { if (i > 0) res.append(delimiter); String part = parts[i]; res.append(Character.toUpperCase(part.charAt(0))); res.append(part, 1, part.length()); } return res.toString(); } public static String capitalize(String str) { return capitalize(str, ""); } }