Jump to content

Autoit Shift characters in a string


Recommended Posts

$sTest = "Hello World"

msgbox(0, '' , stringleft(stringsplit($sTest , " " , 2)[1] , 1) & stringtrimleft(stringsplit($sTest , " " , 2)[0] , 1) & " " & stringleft($sTest , 1) & stringtrimleft(stringsplit($sTest , " " , 2)[1] , 1))

 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

$before = "hello world"

$after = StringUpper("H")&"ello "&StringUpper("W")&"orld"
MsgBox(0, "", $after)

$after = ""

$after = CustomFunc(CustomFunc($before, "h"),"w")
MsgBox(0, "", $after)

;converts matching $part in file to uppercase. Use $occurence to skip matches if neccessary
Func CustomFunc($string, $part, $occurence=1)
    Local $iPos = StringInStr($part, $part, 1, $occurence)
    Return StringMid($string, 1, $iPos-1) & StringUpper(StringMid($string, $iPos, 1)) & StringMid($string, $iPos+1, -1)
EndFunc

StringUpper would be the answer i would think :)

Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...