Java examples for Swing:Introduction
Strips the text from mnemonic indicators.
/*/*from w w w. j a va 2s. c om*/ * Jajuk * Copyright (C) The Jajuk Team * http://jajuk.info * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License * as published by the Free Software Foundation; either version 2 * of the License, or any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * */ //package com.java2s; public class Main { public static void main(String[] argv) throws Exception { String text = "java2s.com"; System.out.println(strip(text)); } /** The character to use as mnemonic indicator. */ public static final char INDICATOR = '_'; /** * Strips the text from mnemonic indicators. * * @param text The text to work on. * * @return The text with all mnemonic indicators stripped. If there are no * indicators in the given text, the original text will be returned. * * @see #INDICATOR */ public static String strip(String text) { return text.replace(String.valueOf(INDICATOR), ""); } }