Here you can find the source of singularOrPlural(int testValue, String singular, String plural)
Parameter | Description |
---|---|
testValue | integer that's either 1 or something else |
singular | what to return if 1 |
plural | what to return if something other than 1 |
public static String singularOrPlural(int testValue, String singular, String plural)
//package com.java2s; /** This class is a PanelLeft factory, creating all panels based on the * contents of the panels.xml file./*from ww w . j a va2 s . c om*/ * * Last Updated: May 25, 2011 * * by Rick C. Hodgin * Cossatot Analytics Laboratories, LLC. (Cana Labs) * * (c) Copyright Cana Labs. * Free software licensed under the GNU GPL2. * * @author Rick C. Hodgin * @version 1.0.0 * * Change history: * 2011-05-25 - 1.0.0 - Initial release * */ public class Main { /** * Returns the singular or plural string based on the test value * @param testValue integer that's either 1 or something else * @param singular what to return if 1 * @param plural what to return if something other than 1 * @return singular or plural string */ public static String singularOrPlural(int testValue, String singular, String plural) { if (testValue == 1) return (singular); return (plural); } }