Checking Plurals With ASP - A Simple Check Plural Function


/ Published in: ASP
Save to your folder(s)

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.


Copy this code and paste it in your HTML
  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)%>

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

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.