Here you can find the source of capitalize(String plainMessage, char letter)
Parameter | Description |
---|---|
plainMessage | a parameter |
letter | a parameter |
public static String capitalize(String plainMessage, char letter)
//package com.java2s; public class Main { /**//from ww w. ja v a 2 s . c o m * Replace all occurrences of letter in plainMessage with toUpperCase(letter) * @param plainMessage * @param letter * @return plainMessage with all occurrences of letter in upper-case. */ public static String capitalize(String plainMessage, char letter) { StringBuffer message = new StringBuffer(plainMessage); for (int i = 0; i < plainMessage.length(); i++) { char c = plainMessage.charAt(i); if (Character.isLetter(c)) { if (Character.toUpperCase(c) == Character .toUpperCase(letter)) { message.setCharAt(i, Character.toUpperCase(c)); } } } return message.toString(); } }