jxn Posted October 21, 2010 Share Posted October 21, 2010 Hi there, I am having some trouble with _StringBetween when learning the basics. Here is the code: #include <String.au3> $test = "<p>This is a test</p>" $abc = _StringBetween($test, "<p>", "</p>") $file = FileOpen("test.txt", 1) FileWrite($file, $abc) FileClose($file) I want to get the text "This is a test", and write it into test.txt file, however, the code fails to work and nothing has been written into the file. Something is wrong with _StringBetween, but I can't figure it out. Can anyone help to identify what the problem is? Thanks Link to comment Share on other sites More sharing options...
bogQ Posted October 21, 2010 Share Posted October 21, 2010 (edited) FileWrite($file, $abc[0]) Return Value Success: A 0 based $array[0] contains the first found string. Edited October 21, 2010 by bogQ TCP server and client - Learning about TCP servers and clients connectionAu3 oIrrlicht - Irrlicht projectAu3impact - Another 3D DLL game engine for autoit. (3impact 3Drad related) There are those that believe that the perfect heist lies in the preparation.Some say that it’s all in the timing, seizing the right opportunity. Others even say it’s the ability to leave no trace behind, be a ghost. Link to comment Share on other sites More sharing options...
jxn Posted October 21, 2010 Author Share Posted October 21, 2010 Great tips! Thanks bogQ. I change $abc into $abc[0], and it runs perfectly now. Link to comment Share on other sites More sharing options...
jxn Posted October 21, 2010 Author Share Posted October 21, 2010 (edited) Oh, one more thing, I found _StringBetween is really powerful in scraping webpages, really helps me a lot! Edited October 21, 2010 by jxn 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