Here you can find the source of pluralize(int count, String singular, String plural)
Parameter | Description |
---|---|
count | count to base if the word should be treated as singular or plural |
singular | single version of the word |
plural | plural version of the word |
public static String pluralize(int count, String singular, String plural)
//package com.java2s; /*// www . j ava2 s.co m * Copyright (c) 2013 Washington State Department of Transportation * * This program is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * (at your option) any later version. * * This program is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with this program. If not, see <http://www.gnu.org/licenses/> * */ public class Main { /** * Returns a singlular or pluralized word. * * @param count count to base if the word should be treated as singular or plural * @param singular single version of the word * @param plural plural version of the word * @return pluralized String */ public static String pluralize(int count, String singular, String plural) { return (count == 1 ? singular : plural); } }