VBcoders Guest



Don't have an account yet? Register
 


Forgot Password?



Changes a string to correct case (first char upper, rest lower) Better than StrConv as it also capi

by Ben Noblet (1 Submission)
Category: String Manipulation
Compatability: Visual Basic 3.0
Difficulty: Unknown Difficulty
Originally Published: Tue 31st October 2000
Date Added: Mon 8th February 2021
Rating: (1 Votes)

Changes a string to correct case (first char upper, rest lower) Better than StrConv as it also capitalises letters after "/" and "-" (and

Rate Changes a string to correct case (first char upper, rest lower) Better than StrConv as it also capi



Dim intCount
Dim blnNextCharUpper 
Dim strCurrentChar
Dim strNewString
 
 for intCount = 1 to len(strOriginalString)
  strCurrentChar = mid(strOriginalString, intCount, 1)
  if blnNextCharUpper or intCount = 1 then
   strNewString = strNewString & Ucase(strCurrentChar)
  else
   strNewString = strNewString & Lcase(strCurrentChar)
  end if
   
  select case strCurrentChar
  Case " ", "/", "-"
   blnNextCharUpper = True
  Case Else
   blnNextCharUpper = False
  end select
 next
 
 ProperCase = strNewString
 
End Function

Download this snippet    Add to My Saved Code

Changes a string to correct case (first char upper, rest lower) Better than StrConv as it also capi Comments

No comments have been posted about Changes a string to correct case (first char upper, rest lower) Better than StrConv as it also capi. Why not be the first to post a comment about Changes a string to correct case (first char upper, rest lower) Better than StrConv as it also capi.

Post your comment

Subject:
Message:
0/1000 characters