Here you can find the source of capitalize(String string)
private static String capitalize(String string)
//package com.java2s; /**/*from ww w . j a va2 s . co m*/ * <copyright> * Copyright (c) 2010-2014 Henshin developers. All rights reserved. * This program and the accompanying materials are made available * under the terms of the Eclipse Public License v1.0 which * accompanies this distribution, and is available at * http://www.eclipse.org/legal/epl-v10.html * </copyright> */ public class Main { private static String capitalize(String string) { if (string == null || string.length() == 0) return string; String first = string.substring(0, 1).toUpperCase(); if (string.length() == 1) return first; return first + string.substring(1); } }