Jump to content
Sign in to follow this  
caramen

[SOLVED]Question about User name and logins

Recommended Posts

caramen

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 by caramen

My video tutorials : HERE ( In construction ) 

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 - Wiki
OutlookEX (2018-10-31 - Version 1.3.4.1) - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version 0.4.0.1) - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version 0.0.5.0) - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki
 
Tutorials:

ADO - Wiki

 

Share this post


Link to post
Share on other sites
JLogan3o13

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 by JLogan3o13
  • Like 1

√-1 2^3 ∑ π, and it was delicious!

How to get your question answered on this forum!

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
Sign in to follow this  

×