Posted By

neal_grosskopf on 03/21/08


Tagged

function ASP


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

neal_grosskopf


Checking Plurals With ASP - A Simple Check Plural Function


 / Published in: ASP
 

URL: http://www.nealgrosskopf.com/tech/thread.asp?pid=7

I notice that a lot of database driven websites make easy mistakes by not checking for plural words. An example might be "2 vote" or "1 votes". Here is an example of a function using ASP to check for plurals.

  1. function CheckPlural(input)
  2. if input << 1 then
  3. CheckPlural = "s"
  4. else
  5. CheckPlural = ""
  6. end if
  7. end function
  8.  
  9.  
  10. 'function can be called like so:
  11. '25 Vote<%=CheckPlural(25)%>

Report this snippet  

You need to login to post a comment.