Posted By

ginoplusio on 11/11/08


Tagged

ucfirst uppercase


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

asifrizvigmailcom


ucfirst in ASP


 / Published in: ASP
 

URL: http://www.barattalo.it/

ucifrst function convert every word of a string in first letter uppercase.

  1. function ucfirst(tname)
  2. ucfirst = ""
  3. tname = tname & " "
  4. do while instr(tname, " ")
  5. temp_string = left(tname, instr(tname," " ) -1)
  6. ' ucase the first letter
  7. ucfirst = ucfirst & ucase(mid(temp_string, 1,1))
  8. ' lcase for rest of word
  9. ucfirst = ucfirst & lcase(mid(temp_string,2)) & " "
  10. tname = right(tname, len(tname) - instr(tname," " ))
  11. loop
  12. 'show me what i get
  13. ucfirst = ucfirst & ucase(mid(tname, 1,1))
  14. ucfirst = ucfirst & mid(tname,2)
  15. ucfirst = Trim(ucfirst)
  16. end Function

Report this snippet  

You need to login to post a comment.