first letter to uppercase

Discussion in 'ASP General' started by Nacho, Apr 5, 2004.

  1. Nacho

    Nacho Guest

    i need to convert the first letter of a veriable to uppercase (the veriable
    is loaded and the applied LCase() )

    thanks
     
    Nacho, Apr 5, 2004
    #1
    1. Advertisements

  2. Nacho

    Dominique Guest

    I did this function and I use it to convert a string to PROPER CASE (first
    letetr cap)

    So we got LCASE()
    and UCASE()

    now we got PCASE :0)

    pCase("this iS my string") ====> "This Is My String"
    pCase("variablename") ====> "Variablename"
    or
    sVar = "variablename"

    pCase(sVar) =====> "Variablename"

    have fun!

    function pCase(str) 'Check the cAsE on that
    putCap = True 'First Letter Gonna be
    Caps
    myString = trim(str) 'Remove Leading and
    Trailing Spaces
    sInc = Chr(32) & Chr(9) & Chr(13) 'Charaters we look for (found
    their char codes online sumwhere)
    for iLen = 1 to Len(myString) 'Check each Character
    mStr = Mid(myString, iLen, 1)
    if putCap = true then 'From previous run -->
    instructed to make this a UCASE char
    bStr = bStr & UCASE(mStr)
    else
    bStr = bStr & LCase(mStr) 'LCASE char
    end if
    if instr(sInc, mStr) then 'Check if this is one
    of our 'Triggers'(like a space or carriage return or tab)
    putCap = true
    else
    putCap = false
    end if
    next
    pCase = bStr 'eH Voila!
    end function
     
    Dominique, Apr 5, 2004
    #2
    1. Advertisements

  3. Nacho

    Hans Guest

    Not sure if this is what you want but here we go...

    yourVariable = "text in lower case"
    yourVariable=Ucase(mid(yourVariable,1,1)) & mid(yourVariable,2)

    You may have to take care of null values.

    Regards
    /Hans
     
    Hans, Apr 5, 2004
    #3
  4. Nacho

    Evertjan. Guest

    Hans wrote on 05 apr 2004 in microsoft.public.inetserver.asp.general:
    yourVariable=Ucase(left(yourVariable,1)) & mid(yourVariable,2)
     
    Evertjan., Apr 5, 2004
    #4
    1. Advertisements

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments (here). After that, you can post your question and our members will help you out.