checked.java

来自「LazyJ是一个快速Web应用程序开发框架。它包括: *.一个非常快的模板引擎」· Java 代码 · 共 41 行

JAVA
41
字号
/** *  */package lazyj.page.tags;import lazyj.Utils;import lazyj.page.StringFormat;/** * <i>checked</i> returns "checked" when the value, as integer, is &gt; 0. Great for quick building * of forms with checkboxes that have integers behind them in the database. *  * @author costing * @since 2006-10-13 */public final class Checked implements StringFormat {	/**	 * If the integer value of this string is positive, return the string "checked", otherwise ""	 * 	 * @param sTag tag name, ignored	 * @param sOption option ("check"), ignored 	 * @param s string to format	 * @return "checked" or "", depending on the integer value of the string.	 */	public String format(final String sTag, final String sOption, final String s) {		int iValue = 0;		try{			iValue = Integer.parseInt(s);		}		catch (NumberFormatException ne){			// ignore		}					final boolean b = iValue>0 || Utils.stringToBool(s, false);				return b ? "checked" : "";	}}

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?