If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > How do I make the first letter of a word capitalized?

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 11-08-02, 13:24
defsteph defsteph is offline
Registered User
 
Join Date: Nov 2002
Posts: 8
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?
Reply With Quote
  #2 (permalink)  
Old 11-09-02, 13:04
rnealejr rnealejr is offline
Registered User
 
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.
Reply With Quote
  #3 (permalink)  
Old 11-09-02, 20:51
defsteph defsteph is offline
Registered User
 
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...
Reply With Quote
  #4 (permalink)  
Old 11-09-02, 22:50
rnealejr rnealejr is offline
Registered User
 
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 ?
Reply With Quote
  #5 (permalink)  
Old 11-10-02, 06:03
defsteph defsteph is offline
Registered User
 
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
Reply With Quote
  #6 (permalink)  
Old 11-10-02, 21:32
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
Where are you pulling the dates from ?
Reply With Quote
  #7 (permalink)  
Old 11-11-02, 04:45
defsteph defsteph is offline
Registered User
 
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?
Reply With Quote
  #8 (permalink)  
Old 11-14-02, 23:24
rnealejr rnealejr is offline
Registered User
 
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)%>
Reply With Quote
  #9 (permalink)  
Old 11-15-02, 06:21
defsteph defsteph is offline
Registered User
 
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
Reply With Quote
  #10 (permalink)  
Old 11-16-02, 23:16
rnealejr rnealejr is offline
Registered User
 
Join Date: Feb 2002
Posts: 2,232
What is the exact code you are using ?
Reply With Quote
  #11 (permalink)  
Old 11-16-02, 23:51
defsteph defsteph is offline
Registered User
 
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
Reply With Quote
  #12 (permalink)  
Old 11-17-02, 00:28
rnealejr rnealejr is offline
Registered User
 
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.
Reply With Quote
  #13 (permalink)  
Old 11-17-02, 13:14
defsteph defsteph is offline
Registered User
 
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
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On