Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

public class Main {
    /**
     * Calculates a key name from a file name.
     * @param friendlyName
     * @return a file system friendly name for this password key
     */
    public static String calculateKey(String friendlyName) {
        friendlyName = friendlyName.trim().toLowerCase();
        friendlyName = friendlyName.replaceAll("\\Q \\E", "-");
        friendlyName = friendlyName.replaceAll("[!@#$%^&*()+\"]", "_");
        return friendlyName;
    }
}