Here you can find the source of cleanFilename(String typeName)
Parameter | Description |
---|---|
typeName | a parameter |
public static String cleanFilename(String typeName)
//package com.java2s; /* uDig - User Friendly Desktop Internet GIS client * http://udig.refractions.net//from w ww . j av a2 s . co m * (C) 2004-2011, Refractions Research Inc. * * All rights reserved. This program and the accompanying materials * are made available under the terms of the Eclipse Public License v1.0 * (http://www.eclipse.org/legal/epl-v10.html), and the Refractions BSD * License v1.0 (http://udig.refractions.net/files/bsd3-v10.html). */ public class Main { /** * Produce a clean filename given a resource typeName. * <p> * This method will replace all non alpha numeric characters with "_". * <p> * Example:<code>String filename = URLUtils.cleanFilename("topp:tasmania_citities");</code> * * @param typeName * @return */ public static String cleanFilename(String typeName) { StringBuffer fix = new StringBuffer(typeName); for (int i = 0; i < fix.length(); i++) { char c = fix.charAt(i); if (!Character.isLetterOrDigit(c)) { fix.setCharAt(i, '_'); } } return fix.toString(); } }