Renderer

Autoit Shift characters in a string

7 posts in this topic

#1 ·  Posted

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!

Share this post


Link to post
Share on other sites



#3 ·  Posted

Did you search _StringProper?

#include <MsgBoxConstants.au3>
#include <String.au3>

$sData='hello world'
MsgBox($MB_ICONINFORMATION,'_StringProper Test',_StringProper($sData))

 

Share this post


Link to post
Share on other sites

#6 ·  Posted

$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))

 


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

Share this post


Link to post
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 :)

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