Java String Pluralize plural(String objectName)

Here you can find the source of plural(String objectName)

Description

plural

License

Open Source License

Declaration

private static String plural(String objectName) 

Method Source Code

//package com.java2s;
/*// w ww. j ava  2  s . c  o  m
(C) 2007 Stefan Reich (jazz@drjava.de)
This source file is part of Project Prophecy.
For up-to-date information, see http://www.drjava.de/prophecy
    
This source file is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation, version 2.1.
*/

public class Main {
    private static String plural(String objectName) {
        return objectName.endsWith("y") ? objectName.substring(0, objectName.length() - 1) + "ies"
                : objectName + "s";
    }
}

Related

  1. plural(int count, String word, String ending)
  2. plural(int nb)
  3. plural(int number, String form1, String form2, String form3)
  4. plural(int size, String name)
  5. plural(String arg)
  6. plural(String singular)
  7. plural(String str, String suffix, int count)
  8. plural(String strSingle, String strPlural, int amount)
  9. plural(String txt)