Here you can find the source of sanitizeFilenameForWindows(String filename)
static public String sanitizeFilenameForWindows(String filename)
//package com.java2s; /* The MIT License (MIT) * Copyright (c) 2014 Nicholas Wright/*ww w . ja va2s .co m*/ * http://opensource.org/licenses/MIT */ public class Main { private static final String[] ILLEGAL_FILENAME_CHARS = { "/", "\\", ":", "?", "\"", "<", ">", "|" }; static public String sanitizeFilenameForWindows(String filename) { String sanitized = filename; for (String ic : ILLEGAL_FILENAME_CHARS) { sanitized = sanitized.replace(ic, "_"); } return sanitized; } }