Java String Plural toPlural(String candidate)

Here you can find the source of toPlural(String candidate)

Description

Converts string to plural form

License

Apache License

Parameter

Parameter Description
candidate a parameter

Return

plural string

Declaration

public static String toPlural(String candidate) 

Method Source Code

//package com.java2s;
// Licensed under the Apache License, Version 2.0 (the "License");

public class Main {
    /**// ww w  .  j  a  v  a  2s  .c o m
     * Converts string to plural form
     * 
     * @param candidate
     * 
     * @return plural string
     */
    public static String toPlural(String candidate) {
        if (candidate.length() >= 1 && !candidate.endsWith("s")) {
            return candidate + "s";
        }
        return candidate;
    }
}

Related

  1. toPlural(String _str)
  2. toPlural(String name)
  3. toPlural(String name)
  4. toPluralForm(String propertyName)