Renderer Posted October 9, 2016 Share Posted October 9, 2016 Hello guys ! How can i shift characters in a phrase ? For example i have the "Hello World" String. How do i shift the H with W? Thanks in advance! Link to comment Share on other sites More sharing options...
l3ill Posted October 9, 2016 Share Posted October 9, 2016 Do you mean switch? or shift? StrinReplace would do the job if its switch... My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
AutoBert Posted October 9, 2016 Share Posted October 9, 2016 Did you search _StringProper? #include <MsgBoxConstants.au3> #include <String.au3> $sData='hello world' MsgBox($MB_ICONINFORMATION,'_StringProper Test',_StringProper($sData)) Link to comment Share on other sites More sharing options...
l3ill Posted October 9, 2016 Share Posted October 9, 2016 $sVar = "Hello World" $sNewString = StringReplace($sVar, "H", "W") MsgBox(0, "", $sNewString) $sNewString = StringReplace($sNewString, "W", "H", -1) MsgBox(0, "", $sNewString) My Contributions... SnippetBrowser NewSciTE PathFinder Text File Manipulation FTP Connection Tester / INI File - Read, Write, Save & Load Example Link to comment Share on other sites More sharing options...
mikell Posted October 9, 2016 Share Posted October 9, 2016 Msgbox(0,"", StringRegExpReplace("Hello World", '(H)(ello )(W)(orld)', "$3$2$1$4") ) Link to comment Share on other sites More sharing options...
iamtheky Posted October 9, 2016 Share Posted October 9, 2016 $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 More sharing options...
genius257 Posted October 10, 2016 Share Posted October 10, 2016 $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 My highlighted topics: AutoIt Package Manager, AutoItObject Pure AutoIt, AutoIt extension for Visual Studio Code Github: AutoIt HTTP Server, AutoIt HTML Parser 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