Jump to content
Sign in to follow this  
ChrisL

StringBetween

Recommended Posts

ChrisL

I can't get this to work and I don't understand why

#include <String.au3>
#include <Array.au3>

$Str = FileRead("test.txt")
Msgbox(0,"","StringLen " & StringLen($Str))
$Data = _StringBetween($str,"<Order>", "</Order>",-1,1)
Msgbox(0,"",@error)
_ArrayDisplay($Data)

Any help please

Thanks

Edit: All sorted attachment removed

Edited by ChrisL

Share this post


Link to post
Share on other sites
funkey

$Str = FileRead("test.txt")
Msgbox(0,"","StringLen " & StringLen($Str))
$Data = StringRegExp($Str, "<Order>(.*?)</Order>", 3)
Msgbox(0,@error, $Data[0]

Edit:

_ArrayDisplay fails:

#include <String.au3>
#include <Array.au3>

$Str = FileRead("test.txt")
Msgbox(0,"","StringLen " & StringLen($Str))
$Data = _StringBetween($str,"<Order>", "</Order>",-1,1)
Msgbox(0,@error, $Data[0])
_ArrayDisplay($Data)
Edited by funkey

Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the Universe
trying to produce bigger and better idiots.
So far, the Universe is winning.

Share this post


Link to post
Share on other sites
Xenobiologist

The problem is ArrayDisplay

#include <String.au3>
#include <Array.au3>

$Str = FileRead("test.txt")
MsgBox(0, "", "StringLen " & StringLen($Str))
$Data = _StringBetween($Str, "<Order>", "</Order>", -1)
MsgBox(0, "", @error)
ConsoleWrite(_ArrayToString($Data) & @CRLF)
_ArrayDisplay($Data)

Scripts & functions Organize Includes Let Scite organize the include files

Yahtzee The game "Yahtzee" (Kniffel, DiceLion)

LoginWrapper Secure scripts by adding a query (authentication)

_RunOnlyOnThis UDF Make sure that a script can only be executed on ... (Windows / HD / ...)

Internet-Café Server/Client Application Open CD, Start Browser, Lock remote client, etc.

MultipleFuncsWithOneHotkey Start different funcs by hitting one hotkey different times

Share this post


Link to post
Share on other sites
ChrisL
ChrisL
Mat

maybe becouse you are trying to get a listview to show a 10917 character string. There is a string in $Data[0], the listview just can't show it :)

Mat

Proof:

#include <String.au3>

$Str = FileRead("test.txt")

Msgbox(0, "Total", "StringLen " & StringLen($Str))
$Data = _StringBetween($str,"<Order>", "</Order>", -1)

MsgBox (0, "Between", "StringLen " & StringLen ($Data[0]))

MsgBox (0, "First 200 characters", StringLeft ($Data[0], 200))

You guys post so fast, by the time i'm done i'm only 6th ;)

Edited by Mat

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
Sign in to follow this  

×