AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Converting first 2 letters to upper case

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
jonathan2260



Joined: 13 May 2008
Posts: 7

PostPosted: Tue May 27, 2008 3:52 pm    Post subject: Converting first 2 letters to upper case Reply with quote

I'm looking for a way to convert the 1st 2 letters of the A_username variable from lower case to upper case for a login issue.

Ex: username jdoe would become JDoe

I imagine using either the StringUpper or StringReplace command and dump it into another variable to do so but do not see how I would apply the commands.

Thank You for the help.
Back to top
View user's profile Send private message
Trikster



Joined: 15 Jul 2007
Posts: 1224
Location: Enterprise, Alabama

PostPosted: Tue May 27, 2008 4:46 pm    Post subject: Reply with quote

Code:
String_Test = test.
String := SubStr(String_Test, 1, 2)
StringUpper, String, String
MsgBox, % String . SubStr(String_Test, 3, StrLen(String_Test))

_________________
ScriptPad | ~dieom | dieom | izwian2k7 | Ian | God
Back to top
View user's profile Send private message
SKAN!
Guest





PostPosted: Tue May 27, 2008 8:59 pm    Post subject: Reply with quote

Code:
Username := DllCall( "CharUpperA", Str,SubStr(A_UserName,1,2),Str) . SubStr(A_UserName,3)
MsgBox, % UserName


Smile
Back to top
DerRaphael



Joined: 23 Nov 2007
Posts: 604
Location: 127.0.0.1

PostPosted: Wed May 28, 2008 2:56 pm    Post subject: Reply with quote

Code:
MsgBox % name := RegExReplace(name:="jdoe","(^.{2})", "$U1")


results is a MsgBox displaying JDoe. using it with A_UserName, looks like this:

Code:
MsgBox % RegExReplace(A_UserName,"(^.{2})", "$U1")


greets
derRaphael
_________________
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group