Here you can find the source of cleanString(String aString)
Parameter | Description |
---|---|
aString | to be cleaned |
public static String cleanString(String aString)
//package com.java2s; /*//from www .j a v a2 s .c om * Copyright (c) 2005-2009 Nokia Corporation and/or its subsidiary(-ies). * All rights reserved. * This component and the accompanying materials are made available * under the terms of "Eclipse Public License v1.0" * which accompanies this distribution, and is available * at the URL "http://www.eclipse.org/legal/epl-v10.html". * * Initial Contributors: * Nokia Corporation - initial contribution. * * Contributors: * * Description: * */ public class Main { /** * * Cleans a string, removing all ' ' and '\t' * * @param aString * to be cleaned * @return a cleaned string */ public static String cleanString(String aString) { StringBuffer lStringBuffer = new StringBuffer(); for (int lStringIndex = 0; lStringIndex < aString.length(); lStringIndex++) { if (aString.charAt(lStringIndex) != ' ' && aString.charAt(lStringIndex) != '\t') { lStringBuffer.append(aString.charAt(lStringIndex)); } } return lStringBuffer.toString(); } }