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
  10. 'function can be called like so:
  11. '25 Vote<%=CheckPlural(25)%>


Report this snippet


RSS Icon Subscribe to comments

You need to login to post a comment.