Java String to convertStringToSafeFilename(String s)

Here you can find the source of convertStringToSafeFilename(String s)

Description

convert String To Safe Filename

License

Open Source License

Declaration

public static String convertStringToSafeFilename(String s) 

Method Source Code

//package com.java2s;
//License from project: Open Source License 

public class Main {
    public static String convertStringToSafeFilename(String s) {
        String ret = s.toLowerCase();
        ret = ret.replaceAll("[\\\\\\/\\:\\*\\?\\\"\\<\\>\\|\\s\\,]", "-");
        return ret;
    }//from  w ww . jav  a 2 s .  c  o  m
}

Related

  1. convertStringToLiteral(String className, String value)
  2. convertStringToObject(String value, Class type)
  3. convertStringToPrimaryKey(String keyString)
  4. convertStringToPrimitive(Object object, Class toType)
  5. convertStringToPrimitive(String value, Class destinationClass)
  6. convertStringToValue(String txt, Class klass)
  7. convertStringToVarName(final String str)
  8. convertStringToWord(String strValue)
  9. convertStringWithReplacementPattern(final String originalString, final String pattern, final String replace)