Jump to content

[SOLVED]Question about User name and logins

Recommended Posts

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 : ( 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


 Water's UDFs:
Active Directory (NEW 2018-10-19 - Version - Download - General Help & Support - Example Scripts - Wiki
OutlookEX (2018-10-31 - Version - Download - General Help & Support - Example Scripts - Wiki
ExcelChart (2017-07-21 - Version - Download - General Help & Support - Example Scripts
PowerPoint (2017-06-06 - Version - Download - General Help & Support
Excel - Example Scripts - Wiki
Word - Wiki

ADO - Wiki


Link to post
Share on other sites
  • Moderators

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)

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

"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 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
  • Recently Browsing   0 members

    No registered users viewing this page.

  • Create New...