caramen Posted December 15, 2016 Share Posted December 15, 2016 (edited) Hello guys I already done that in the past but i cant remember how i did. Local $sAnswer = InputBox("User name", "Plz enter the user name and lastname", "Answer", "") When the answer gonna be Tony MONTANA How can i transform into TMontana I guesse it s somthing with split to array or ? Edited January 2, 2017 by caramen My video tutorials : ( In construction ) || My Discord : https://discord.gg/S9AnwHw How to Ask Help || UIAutomation From Junkew || WebDriver From Danp2 || And Water's UDFs in the Quote Spoiler Water's UDFs:Active Directory (NEW 2018-10-19 - Version 1.4.10.0) - Download - General Help & Support - Example Scripts - WikiOutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - WikiExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example ScriptsPowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & SupportExcel - Example Scripts - WikiWord - Wiki Tutorials:ADO - Wiki Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 15, 2016 Moderators Share Posted December 15, 2016 (edited) Something like this, perhaps: Local $sQuery = InputBox("User name", "Plz enter the user name and lastname", "Answer", "") Local $aSplit = StringSplit($sQuery, " ") If IsArray($aSplit) Then ConsoleWrite(StringLeft($aSplit[1], 1) & StringLeft($aSplit[2], 1) & StringLower(StringTrimLeft($aSplit[2], 1)) & @CRLF) EndIf Now, I am sure you could do it with Regex, unfortunately regex makes my eyes bleed. This is as close as I could come. Perhaps one of our regex geniuses will wander by and improve upon it. Only works if the last name is not all caps. #include <StringConstants.au3> Local $sQuery = InputBox("User name", "Plz enter the user name and lastname", "Answer", "") Local $aSplit = StringRegExp($sQuery, '[A-Z]+[a-z]+', $STR_REGEXPARRAYGLOBALMATCH) Local $aAnswer = StringLeft($aSplit[0], 1) & $aSplit[1] ConsoleWrite($aAnswer & @CRLF) Edited December 15, 2016 by JLogan3o13 caramen 1 "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now