Jump to content

how to get a certain word out of a phrase


vladedoty
 Share

Recommended Posts

$title = "Whiteleaf - Leaves - Branch - Leaves"

I need to know how to get the first word regardless of what it is (In this instance Whiteleaf) out of this variable.

I though maybe u could use $newTitle = StringTrimRight($title, StringInStr($title, "-", ????? (can anyone finish this?

Link to comment
Share on other sites

This will put all of the letters before a space into $firstword[0].

$title =  "Whiteleaf - Leaves - Branch - Leaves"

$firstword = StringRegExp($title, "([^ ]{1,})", 1)

MsgBox(0, "", $firstword[0])

The Wheel of Time turns, and Ages come and pass, leaving memories that become legend. Legend fades to myth, and even myth is long forgotten when the Age that gave it birth comes again.

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