Jump to content

Recommended Posts

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

  Reveal hidden contents

 

  • Moderators
Posted (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 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!

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...