Here you can find the source of toUpperCaseUnderscore(String text)
public static String toUpperCaseUnderscore(String text)
//package com.java2s; public class Main { /**//from w w w. j a v a 2s. c o m * Whitespace is a String with one whitespace. */ public final static String WHITESPACE = " "; public static String toUpperCaseUnderscore(String text) { text = text.toUpperCase().trim(); text = text.replace(WHITESPACE, "_"); return text; } }