gazkin Posted July 17, 2008 Share Posted July 17, 2008 Hi Guys, I want to split a sentence in a array that contains all words used in the sentence. If I use this script $text = StringReplace("this is a line of text", " ", " ") MsgBox(0, "New string is", $text[1]) It tells me that $text doesnt contain an array. How to handle this? Link to comment Share on other sites More sharing options...
DMEE Posted July 17, 2008 Share Posted July 17, 2008 StringReplace returns a new string according to the help file. I guess you need: #Include <String.au3> $text = _StringSplit("this is a line of text", " ") In the beginning there was nothing and then even that exploded - anonymous Link to comment Share on other sites More sharing options...
GaryFrost Posted July 17, 2008 Share Posted July 17, 2008 StringReplace returns a new string according to the help file. I guess you need: #Include <String.au3>$text = _StringSplit("this is a line of text", " ")Just use the built in function StringSplit, _StringSplit is obsolete and will be gone from the next version. SciTE for AutoItDirections for Submitting Standard UDFs Don't argue with an idiot; people watching may not be able to tell the difference. Link to comment Share on other sites More sharing options...
rasim Posted July 17, 2008 Share Posted July 17, 2008 gazkinThis?#include <Array.au3> $string = "Hello world! AutoIt rulez!" $split = StringSplit($string, " ") _ArrayDisplay($split) Link to comment Share on other sites More sharing options...
smashly Posted July 17, 2008 Share Posted July 17, 2008 You could also use StringRegExp() #include <array.au3> $String = "How long is a piece of string?" $aString = StringRegExp($String, "\w+\S", 3) _ArrayDisplay($aString, "$aString") Cheers 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