Java File Name Create toFileName(String address)

Here you can find the source of toFileName(String address)

Description

to File Name

License

Open Source License

Declaration

static public String toFileName(String address) 

Method Source Code

//package com.java2s;

public class Main {
    static public String toFileName(String address) {
        StringBuilder builder = new StringBuilder();
        int i = 0;
        while (i < address.length()) {
            char c = address.charAt(i);
            if (Character.isLetterOrDigit(c)) {
                builder.append(c);//w  w w.jav a  2  s. c  o  m
            } else {
                builder.append('_');
            }
            i++;
        }
        builder.append(".html");
        return builder.toString();
    }
}

Related

  1. generateFileName()
  2. generateFileName(String fileName)
  3. generateFileNameWithoutExtension(final String testClassName, final String testId, final boolean includeDate)
  4. getRandomFileName(@Nullable final String prefix)
  5. toFileName(final Object obj)
  6. toFileName(String className)
  7. toFilename(String filenameOrURI)
  8. toFilename(String key, final String suffix)
  9. toFileName(String moduleName)