Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Uppercase to Lowercase
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Uppercase to Lowercase

 Post Reply Post Reply Page  <12
Author
Phat View Drop Down
Senior Member
Senior Member


Joined: 23 February 2003
Status: Offline
Points: 386
Post Options Post Options   Thanks (0) Thanks(0)   Quote Phat Quote  Post ReplyReply Direct Link To This Post Posted: 19 May 2004 at 4:33am
Originally posted by zMaestro zMaestro wrote:

the question now is, If i have a text written ALL IN CAPITAL LETTERS, I want to change it into small case But reserve the first letter in each word Capital.

now, it's a little difficult.



Must have way too much time on my hands. So here you go


<%
Public Function Correctcase(Thestring)

    Dim iCounter 'As Integer
   
   
    If Thestring <> "" Then
        Thestring = LCase(Thestring)
        Thestring = UCase(Left(Thestring, 1)) + Right(Thestring, Len(Thestring) - 1)
        For iCounter = 1 To Len(RTrim(Thestring)) - 1
             If Mid(Thestring, iCounter, 1) = " " Or Mid(Thestring, iCounter, 1) = "-" Or Mid(Thestring, iCounter, 1) = "'" Or Mid(Thestring, iCounter, 1) = "." Then
         Thestring = Left(Thestring, iCounter) + UCase(Mid(Thestring, iCounter + 1, 1)) + Right(Thestring, Len(Thestring) - (iCounter + 1))
        End If
        Next
        Correctcase = Thestring
    End If

   
   
End Function

Dim strText
Dim strNew
Dim tmpString
Dim i
Dim splitText

splittext = "the question now is, If i have a text written ALL IN CAPITAL LETTERS, I want to change it into small case But reserve the first letter in each word Capital."

strText = Split(splittext, " ", -1  , 1)

For i = 0 To UBound(strText) - 1
    tmpString = strText(i)
    strNew = strNew & Correctcase(tmpString) & " "
Next

Response.Write(strNew)

%>



Edited by Phat
Back to Top
 Post Reply Post Reply Page  <12

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.