Community discussion forum

Proper Capitalization

This is a comment thread discussing Proper Capitalization
  • 9 years ago

    This thread is for discussions of Proper Capitalization.

  • Advertisement

    Simply the fastest line-level profiler for .NET ever

    “The low overhead means it has minimal impact on the execution of my program”
    Mark Everest, Development Team Leader, Renault F1 Team Ltd.

    Try out the new ANTS Profiler 4 for yourself. Download your 14-day trial now

  • 4 years ago

    This did exactly what I needed it to do. I had a list of company names that were all in caps, so I used this little function. Instead of "Response.Write strTempName" I used "PropCase = strTempName".


    Thanks for the code.

  • 3 years ago

    An alternative to do a similar thing but which possibly runs a lot faster:
    <%
    Function EIPropCase(EIString)
       ' Developed by Ken Good of Edge Impact Consulting Ltd, www.edgeimpact.co.uk
       ' This function will change the first letter of every word in a sting to upper case, for
       ' example the string "the west   wing is    where we practice karate" will be changed to
       ' "The West Wing Is Where We Practice Karate"
       Dim EIResultArray
       Dim EICnt
       EIResultArray = split(EIString," ")
       For EICnt = lbound(EIResultArray) to ubound(EIResultArray)
           EIPropCase = EIPropCase & " " & ucase(Left(EIResultArray(EICnt),1)) & mid(EIResultArray(EICnt),2)
       Next
       EIPropCase = mid(EIPropCase,2)
    End Function
    %>

  • 3 years ago

    Hi Ken,


    I found your function to proper case a string very useful. Would it be possible for the function to work if there were linefeeds in the string?


    E.G


    mr anyone
    15 anywhere street
    london


    This address string format confused the function a bit because of the linefeeds.


    How could the function be changed to deal with this type of string.


    Thank you.


    Colin

  • 3 years ago

    I am fairly new to ASP and so forth,,  alot of learning....  been give the code to capitalize words of:


    <%
    Function PropCase(strTemp)
    Dim intFound
    Dim strTempName


    Do
      strTempName = strTempName & UCase(Left(strTemp, 1))
      strTemp     = Right(strTemp, Len(strTemp) - 1)
      intFound    = InStr(strtemp, " ")
      If intFound <> 0 Then
        strTempName = strTempName & Left(strTemp, intFound)
        strTemp = Right(strTemp, Len(strTemp) - intFound)
      Else
        strTempName = strTempName & strTemp
        Exit Do
      End If
    Loop While intFound <> 0
    Response.Write strTempName
    End Function
    %>


    When my users log on it says: welcome with the script <%
    response.write(Session("MM_Username"))
    %>!  I am trying to fit this code to capitalize with the code I already have and I am not sure how or where to place it.  


    I appreciate anybodys help that can offer it.  Thanks, Chuck

  • 3 years ago

    I am fairly new to ASP and so forth,,  alot of learning....  been give the code to capitalize words of:


    <%
    Function PropCase(strTemp)
    Dim intFound
    Dim strTempName


    Do
     strTempName = strTempName & UCase(Left(strTemp, 1))
     strTemp     = Right(strTemp, Len(strTemp) - 1)
     intFound    = InStr(strtemp, " ")
     If intFound <> 0 Then
       strTempName = strTempName & Left(strTemp, intFound)
       strTemp = Right(strTemp, Len(strTemp) - intFound)
     Else
       strTempName = strTempName & strTemp
       Exit Do
     End If
    Loop While intFound <> 0
    Response.Write strTempName
    End Function
    %>


    When my users log on it says: welcome with the script <%
    response.write(Session("MM_Username"))
    %>!  I am trying to fit this code to capitalize with the code I already have and I am not sure how or where to place it.  


    I appreciate anybodys help that can offer it.  Thanks, Chuck
    < Prev | 1 | Next >


     

Post a reply

Enter your message below

Sign in or Join us (it's free).