Caps On 1st Letter

Platform:  mIRC
Published  Sep 20, 2010
Updated  Sep 20, 2010
This is just for that user who want to 1st letter on on 1:INPUT:*: {
set %Var3 $1-
unset %Var1 %Var2
set %Var1 1 | set %Var2 $upper($mid(%Var3,1,1))
if ($mid(%Var3,1,1) == $chr(47)) { goto ServerCommand }
if ($len(%Var3) == 1) { set %Var2 $upper(%Var2) | say %Var2 | halt }
:Start1
inc %Var1 1
if ($mid(%Var3,%Var1,1) != $chr(32)) { set %Var2 %Var2 $+ $mid(%Var3,%Var1,1) | if ($len(%Var3) < %Var1) { goto Start1 } }
if ($mid(%Var3,%Var1,1) == $chr(32)) { set %Var2 %Var2 $+ $upper($mid(%Var3,%Var1,2)) | inc %Var1 1 | if ($len(%Var3) < %Var1) { goto Start1 } }
if ($len(%Var3) != %Var1) { goto Start1 }
say %Var2
halt
:ServerCommand
}
menu channel {
All 1st Letter Caps
.on { set %script true }
.off { unset %script }

Comments

Sign in to comment.
Gummo   -  Jan 31, 2011
That explains the old programming style.
 Respond  
Jethro   -  Jan 23, 2011
itsmefahad, nice find. This snippet is apparently ripped from another one about 5 years ago.
 Respond  
itsmefahad   -  Jan 23, 2011
This Code Already Added In
http://www.hawkee.com/snippet/1570/

And This Guy ReAdd This Code :|
 Respond  
Jethro   -  Nov 23, 2010
Gummo, I'm aware of that could happen, and if you want to get technical, there will always be a "what-if possibility" to take into consideration. I wasn't being meticulous when it came to matching in the regex. I was basically copying if off from the example shown above my initial post for a quick solution. Nevertheless, though, I agree with you about using the "negative lookaround" method to enhance the foolproof level of regex.
 Respond  
Gummo   -  Nov 23, 2010
Using \w as your regex pattern by itself will match any word character after any word boundary. That means that "Jethro's" would become "Jethro'S"
For matching words alone you can use

Code

 

If you still want to match words in other places like "[Hello]" then you need a more complex check if you want to do this accurately.
 Respond  
Styleofglobal   -  Nov 23, 2010
@Jethro_, Thanks thank thank thanks :D [first letter of each and every word in a sentence in CAPS and BOLD:] this is am looking for :D

Thanks Again

Sorry for Bad English ....
 Respond  
Jethro   -  Nov 22, 2010
Styleofglobal, I'm not sure which one you want, so these two snippets below are for you to pick:

This one below will make the first letter of each and every word in a sentence in CAPS and BOLD:

Code

 
e.g. Hello Styleofglobal, I's A Beautiful Day

This one below will only make the first letter of a sentence in CAPS and BOLD:

Code

 
e.g. Hello Styleofglobal, it's a beautiful day.
 Respond  
Styleofglobal   -  Nov 22, 2010
@cofve.. frnd :( i want only caps later in bold, i did "set %Var2 [ctrl+b here] %Var2" now its showing all laters bold ....

Help Please Thanks :)

Sorry for Bad English ....
 Respond  
cofvempire   -  Nov 21, 2010
where say %var2 stands press ctrl+b in the middle of say and %var2
ctrl+b is bold letters
 Respond  
Styleofglobal   -  Nov 21, 2010
@smspeople Help me, I Want Caps On 1st Letter In Bold ...


Sorry for Bad English :P
 Respond  
BoosteeR   -  Oct 02, 2010
Okay, thanks m8 :)
 Respond  
Jethro   -  Sep 26, 2010
BoosteR, if you only want to set the first letter of a sentence capitalized, you could use:

Code

 

 Respond  
BoosteeR   -  Sep 26, 2010
So u would use

Code

 


to set the 1st letter in the sentence caps, or ?
 Respond  
napa182   -  Sep 25, 2010
BoosteeR Said:

Quote

Cant u make it so i only set the 1st letter in the whole sentence caps ?


um you can just use

Code

 

for that try it using this alias

Code

 


but the whole point of his snippet was to make every 1st letter said a cap.
for that i would use

Code

 
 Respond  
BoosteeR   -  Sep 25, 2010
Cant u make it so i only set the 1st letter in the whole sentence caps ?
 Respond  
Jethro   -  Sep 21, 2010
opps, my bad. :P
 Respond  
WorldDMT   -  Sep 21, 2010
@napa182: yeah the regsubex replace the while loop but too complicate for him :p
@aucun50: merci c'est gentil ;)
 Respond  
Aucun50   -  Sep 21, 2010
Nice shirt WorldDMT
 Respond  
smspeople   -  Sep 21, 2010
Dear napa182, Ty sir
 Respond  
napa182   -  Sep 20, 2010
could also do

Code

 
 Respond  
WorldDMT   -  Sep 20, 2010
may be set %Var2 $upper(%Var2) | say %Var2 | halt have to be set %Var2 $upper(%Var3) | say %Var2 | halt

but why u unset the variable you can just set it but you can use /var too

where is the condition if (%script) ????

your code can be like this

Code

 
 Respond  
[Plornt]   -  Sep 20, 2010
You're missing an end bracket by the way
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.