Forums: How to save all data in the database in proper case - Forums

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How to save all data in the database in proper case

#1 User is offline   admin 

  • Administrator
  • PipPipPip
  • Group: Admin
  • Posts: 16044
  • Joined: 03-February 03

Posted 09 July 2014 - 09:56 PM

Proper case means first letter in each word is capitalized i.e. "Mr. Jack Black"
Here is how you can do this in ASPRunnerPro.

1. Add the following code to AfterAppInit event:
Function pCase(strIn) 
strOut = "" 
nextLetterUp = True 
For x = 1 To Len(strIn) 
c = Mid(strIn, x, 1)
If isNumeric(c) Then
strOut = strOut & c
nextLetterUp = true 
ElseIf c = " " or c = "'" or c = "-" then 
strOut = strOut & c 
nextLetterUp = True 
Else 
If nextLetterUp Then 
tc = Ucase(c) 
Else 
tc = LCase(c) 
End If 
strOut = strOut & tc 
nextLetterUp = False 
End If 
Next 
pCase = strOut 
End Function 


2. Add the following code to BeforeAdd and BeforeEdit events

values("FullName")=pCase(values("FullName"))


Replace "FullName" with the actual field name.
Best regards,
Sergey Kornilov
0

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic