[OT] Plurlize() Method

Tech Tip: Click here to run a free scan for Windows Errors and optimize PC performance



This is off-topic slightly and not language dependant. But still, I would like some pointers or suggestions regarding a pluralize method. I have a method which accepts a string and I have it returning the plural form of the specified string (where the specified string is a single word or word combination). I know these types of methods won't work 100% of the time, but a good majority of the words should work.

Any suggestions or pointers on if I'm missing anything to the following logic would be appreciated:

If the word is null or empty, return the word (null or empty).
If the length of the word is 1 character, return the character + "s".
If the entire word is upper-case:
If the word ends in an "s", return the word + "S".
If the word ends in "is", remove the "is" and return the remaining portion of the word + "es".
If the word ends with "s", "z", "x", "ch", or "sh", return the word + "es".
If the word ends in "y":
If the word ends with an "ay", "ey", "iy", "oy", or "uy", return the word + "s".
Otherwise, remove the last character and return the remaining word + "ies".

Last case scenario, if the above conditions do NOT match the specified word, return the word + "s".

Thanks,
Mythran


.



Relevant Pages

  • Re: [OT] Plurlize() Method
    ... like some pointers or suggestions regarding a pluralize method. ... I have a method which accepts a string and I have it returning the plural form of the specified string. ... Any suggestions or pointers on if I'm missing anything to the following logic would be appreciated: ... If the length of the word is 1 character, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: [OT] Plurlize() Method
    ... would like some pointers or suggestions regarding a pluralize method. ... I have a method which accepts a string and I have it returning the plural form of the specified string. ... Any suggestions or pointers on if I'm missing anything to the following logic would be appreciated: ... If the length of the word is 1 character, ...
    (microsoft.public.dotnet.languages.csharp)
  • Re: get text from listbox
    ... The first character is the low byte of the low word of the DWORD item data ... addressing memory in a virtual address space of 2 GB (memory allocation ... To prove that these are pointers get the item data of the list items as ... string pointer; check it by reading some bytes from the memory to which the ...
    (microsoft.public.vb.winapi)
  • Re: get text from listbox
    ... Dim nCount As Long ... Dim Buffer As String ... The first character is the low byte of the low word of the DWORD item data ... To prove that these are pointers get the item data of the list items as ...
    (microsoft.public.vb.winapi)
  • Re: get text from listbox
    ... The first character is the low byte of the low word of the DWORD item data ... addressing memory in a virtual address space of 2 GB (memory allocation ... To prove that these are pointers get the item data of the list items as ... string pointer; check it by reading some bytes from the memory to which the ...
    (microsoft.public.vb.winapi)