Jump to content

string delete before character


Recommended Posts

So say i have a string like this: Hello-World

How would i delete everything before and including the dash so it would just be: World

Keeping in mind that the string lengths and character positions change, but always follow this format.

nvm, i figured it out

Link to comment
Share on other sites

  • Moderators

Just everything before?

$String = 'Hello-World'
$OutPut = StringTrimLeft($String, StringInStr($String, 'World') - 1)
MsgBox(0, "String", $OutPut)

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

Link to comment
Share on other sites

Just everything before?

$String = 'Hello-World'
$OutPut = StringTrimLeft($String, StringInStr($String, 'World') - 1)
MsgBox(0, "String", $OutPut)
i never use those StringTrim's, not for any particular reason, i always just use the stringleft and stringright

$OutPut = StringRight($string,StringLen($string)-StringInStr($string,"-"))
Link to comment
Share on other sites

  • Moderators

i never use those StringTrim's, not for any particular reason, i always just use the stringleft and stringright

$OutPut = StringRight($string,StringLen($string)-StringInStr($string,"-"))
I'm sure there is a reason... probably to be difficult and just see how much you could confuse someone!! :P

Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.

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