PageRenderTime 18ms CodeModel.GetById 12ms app.highlight 2ms RepoModel.GetById 2ms app.codeStats 0ms

/src/main/java/com/googlecode/struts2yuiplugin/tools/YUITools.java

http://struts2yuiplugin.googlecode.com/
Java | 20 lines | 10 code | 2 blank | 8 comment | 3 complexity | 78642bb6468e7b95834fdc3abbbacade MD5 | raw file
 1package com.googlecode.struts2yuiplugin.tools;
 2
 3public class YUITools {
 4
 5     /**
 6     * Remove characters that are unsafe for use as a javascript variable name
 7     *
 8     * This is the same implementation as appears in UIBean but here it's available to support classes
 9     *
10     * @param name
11     * @return
12     */
13    public static String sanitizeForJavascript(String name) {
14        if (name != null) {
15            return name.replaceAll("[\\.\\[\\]]", "_");
16        } else {
17            return "";
18        }
19    }
20}