Results 1 to 13 of 13
  1. #1
    Join Date
    Nov 2002
    Posts
    8

    Unanswered: How do I make the first letter of a word capitalized?

    This is what i want to do:
    Make the months show like "January" instead of "january", or rather in Swedish "Januari".

    is there a possibility to do something similar to the javascript toUpperCase(); ??

    but I don't want the entire word to be in capitals, just the first letter...

    i think this is tricky...
    (but i know there's probably some feature that does this in a jiffy, there usually is)

    Anyone got any ideas?

  2. #2
    Join Date
    Feb 2002
    Posts
    2,232
    Basically, you have to make your own. In vbscript, just ucase(left(x,1)) & right(x,len(x) - 1).

    Let me know if you need this for javascript.

  3. #3
    Join Date
    Nov 2002
    Posts
    8
    you don't think that you could help me with this? where should i put this code? i'm pretty stupid you know...

  4. #4
    Join Date
    Feb 2002
    Posts
    2,232
    How often do you need this code ? What language do you need it in ?
    How many pages need this code ?

  5. #5
    Join Date
    Nov 2002
    Posts
    8
    The scripts are in VBScript (i think, whatever the default language is, you see, i "stole" this script from a free scripts site), and i need it in two pages. Also I'd like to change the order of the date from "november 8" and so it looks like "8 November" when everything is applied...

    Very much appreciated!
    /Stephan

  6. #6
    Join Date
    Feb 2002
    Posts
    2,232
    Where are you pulling the dates from ?

  7. #7
    Join Date
    Nov 2002
    Posts
    8
    Everything is pulled from an access dB, but i suppose that the <%=MonthName(nextMonth)%> defines what month to print out, however, I can't find this MonthName anywhere in the script or the dB except for when it's called upon in the HTML. This must mean it's a built-in thing, right? Then how do I change how it's printed to the HTML? where should I put that (ucase...) that you showed me?

  8. #8
    Join Date
    Feb 2002
    Posts
    2,232
    Sorry for the delay... the MonthName is a vbscript function ... It depends on where you want to show the proper case. So in your example you could use the following:

    <%= ucase(left(monthname(nextMonth),1)) & right(monthname(nextMonth),len(monthname(nextmonth )) -1)%>

  9. #9
    Join Date
    Nov 2002
    Posts
    8
    Thank You!
    everything worked out fine,
    but as always, there's a "but"...
    when I tried to apply that same code string to:
    <%=MonthName(Month(request("date")))%>
    i got an error saying "can't use parethesis when calling a Sub"...

    so...
    u think you can help me out fixing this one too?

    thanks!
    /steph

  10. #10
    Join Date
    Feb 2002
    Posts
    2,232
    What is the exact code you are using ?

  11. #11
    Join Date
    Nov 2002
    Posts
    8
    <%= ucase(left(MonthName(Month(request("date"))),1)) & right(MonthName(Month(request("date")))),len(Month Name(Month(request("date"))))) -1)%>

    or

    <%= ucase(left(MonthName(Month(request("date")), true),1)) & right(MonthName(Month(request("date")), true)),len(MonthName(Month(request("date")), true))) -1)%>

    depending on where and and how..., but if i could get one of these to work, the other would too...

    thanks!
    /steph

  12. #12
    Join Date
    Feb 2002
    Posts
    2,232
    The problem with both statements is the 2nd half of the statement. You need to count your parenthesis and you will see that there is a problem.

    For example:

    <%= ucase(left(MonthName(Month(request("date"))),1)) &
    right(MonthName(Month(request("date"))),
    len(MonthName(Month(request("date")))) -1)%>

    Test it out and let me know.

  13. #13
    Join Date
    Nov 2002
    Posts
    8
    okay, you got me...

    i've worked it out... had my parenthesis f-ed up, but now they're just fine

    Thanks for all your help.

    Now I know were to turn if something else turns up.

    /steph

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •