public static String convertToId(String name) {
    return CharMatcher.inRange('a', 'z')
        .or(CharMatcher.inRange('A', 'Z'))
        .or(CharMatcher.inRange('0', '9'))
        .or(CharMatcher.is(' '))
        .or(CharMatcher.is('-'))
        .retainFrom(name)
        .replace(' ', '-')
        .toLowerCase();
  }
Converts a given String into one that can be used in css.
Accepts only characters that match 'a' to 'z', 'A' to 'Z', '0' to '9', ' ' and '-'.
All uppercase letters are converted into a lowercase and spaces are replaced by '-'.

@param name the {@link String} to be converted into an css id
@return     the converted {@link String} with only the allowed characters,
            characters in lowercase and whitespaces replaced by '-'
workbenchfx-core/src/main/java/com/dlsc/workbenchfx/util/WorkbenchUtils.java