The Daily Click ::. Forums ::. Klik Coding Help ::. Capitalizing a single letter
 

Post Reply  Post Oekaki 
 

Posted By Message

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
1st November, 2008 at 10:15:33 -

I want to capitalize the first letter of a word automatically. E.g. if the word was "john", it would be "John". What's an easy way to do that?

It works if I do
Upper$(Left$("john", 1))+Right$("john", Len("john")-1)


But that means, with my name-reading array code, it becomes
Upper$(Left$(StrAtXYZ( "Array", index x( "Array" )+1, index y( "Array" ), 0), 1))+Right$(StrAtXYZ( "Array", index x( "Array" )+1, index y( "Array" ), 0), Len(StrAtXYZ( "Array", index x( "Array" )+1, index y( "Array" ), 0))-1)

That's for a single word! Making a text-based game will break the expression editor.

EDIT: It sure screwed up TDC's screen

Image Edited by an Administrator.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Klikmaster

Master of all things Klik

Registered
  08/07/2002
Points
  2599

Has Donated, Thank You!You've Been Circy'd!VIP MemberPS3 Owner
1st November, 2008 at 12:11:48 -

I can't think of a way to do it better, an extension maybe?

 
n/a

aphant



Registered
  18/05/2008
Points
  1242
1st November, 2008 at 17:42:03 -

Can't it just be capitalized in the array?

 

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
1st November, 2008 at 23:41:59 -


Originally Posted by Adam Phant
Can't it just be capitalized in the array?


Well, sometimes I want it put in without caps, like say, with the word "sword" (John was a bad example). It would usually be (You pick up a sword), not (You pick up a Sword), but sometimes I want it to be (Sword breaks!), not (sword breaks!). That's what I need the capitalization thingy for.

It makes a huge difference to presentation

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Cecilectomy

noPE

Registered
  19/03/2005
Points
  305

Has Donated, Thank You!VIP MemberWeekly Picture Me This Winner!Cardboard BoxGhostbuster!Pokemon Ball!ComputerBox RedSanta HatSnowman
I am an April Fool
2nd November, 2008 at 01:04:28 -

so why dont you just do first letter of a sentence?

 
n/a

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
2nd November, 2008 at 01:49:40 -

Um yeah, that's what I meant. First letter of the first word

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Del Duio

Born in a Bowling Alley

Registered
  29/07/2005
Points
  1078

GOTW WINNER CUP 1!GOTW WINNER CUP 2!GOTW WINNER CUP 3!GOTW WINNER CUP 4!Evil klikerHasslevania 2!The OutlawSanta Boot
3rd November, 2008 at 18:26:28 -

Sorry I'm late.

Does MMF support the Ucase command? I know with VB you could just put something like Ucase(Left$("NAME",1)) and it'd instantly capitalize it for you. Not sure if MMF does but since VB and MMF share stuff like Mid$, Left$, Right$, Len, etc it might be worth a shot and see if it works Muz.

 
--

"Del Duio has received 0 trophies. Click here to see them all."

"To be a true ninja you must first pick the most stealthy of our assorted combat suits. Might I suggest the bright neon orange?"

DXF Games, coming next: Hasslevania 2- This Space for Rent!

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
3rd November, 2008 at 21:20:12 -

Doesn't work. The upper$ command does work, but it does it for the whole thing, which is nasty.

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image

Assault Andy

Administrator
I make other people create vaporware

Registered
  29/07/2002
Points
  5686

Game of the Week WinnerVIP Member360 OwnerGOTM JUNE - 2009 - WINNER!GOTM FEB - 2010 - WINNER!	I donated an open source project
7th November, 2008 at 02:35:41 -

What you first suggested is probably one of the few ways to do it. However to make it simpler, load the StrAtXYZ into a temp string and then you only have to apply the alterations to that:

Set Tempstring to StrAtXYZ( "Array", 1,1,1)
Set TempLen to Len(Tempstring)
Set NewString to Upper$(Left$(Tempstring, 1))+Right$(Tempstring, TempLen-1)

 
Creator of Faerie Solitaire:
http://www.create-games.com/download.asp?id=7792
Also creator of ZDay20 and Dungeon Dash.
http://www.Jigxor.com
http://twitter.com/JigxorAndy

Muz



Registered
  14/02/2002
Points
  6499

VIP MemberI'm on a BoatI am an April FoolHonored Admin Alumnus
7th November, 2008 at 03:09:36 -

Hmm.. that is a good idea. It'd be much easier to do in C++ and such, but that's a good way to do it in MMF2. Thanks!

 
Disclaimer: Any sarcasm in my posts will not be mentioned as that would ruin the purpose. It is assumed that the reader is intelligent enough to tell the difference between what is sarcasm and what is not.

Image
   

Post Reply



 



Advertisement

Worth A Click