Jump to content

String Split fileread


Recommended Posts

Hi guys, looking to strip a 6mil + character file into sectrions that i can manage, my thoughts were the following snippet would allow me to split the sections up however it doesnt seem to split the string?? am i forgettign something, i feel that its something simple.... or am i just loosing the plot...


 

MsgBox(0,"",$sFile)             ;===========this correctly shows the file path
    $FileData = FileRead($sFile)
MsgBox(0,"",StringLeft($fileData,100)) ;=============shows the correct 100 chars
    If @error then Err(3) ;============ doesnt trigger (this is a error function to show a msg box thats custom)

    $splitMeta = StringSplit($fileData,"meta=")
    MsgBox(0,"",$splitMeta[2]) ; ====================returns blank!!!!!!!!!!!!!!!!!

;;;;;;;;; i would then run a further x number of splits to break the string down into half

    ;;;;;; $splitInfo = StringSplit($splitMeta[2],"info=")
  ;;;;;;  _ArrayDisplay($splitInfo,"test")

error in console is

(150) : ==> Array variable has incorrect number of subscripts or subscript dimension range exceeded.:

 

at first i thought maybe it was too but even a file containing this doesnt work

Quote

IES     1 return {ap={tiles=",meta={build_version="343524"

 

Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

Link to comment
Share on other sites

use array display instead of msgbox.

when i recreated your example and used array display it had everything broken up and just by coincidence array[2] happened to be blank.

If @error Then
    MsgBox(262192, "", @ComputerName & " slaps " & @UserName & " around a bit with a large trout!")
EndIf

"Yeah yeah yeah patience, how long will that take?"  -Ed Gruberman

REAL search results  |  SciTE4AutoIt3 Editor Full Version

Link to comment
Share on other sites

Cheers.  I did that at the start but the issue was that array (2) should contain "{build_version="343524"

Wich I can then use in another stringsplit or am I missing something?

Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

Link to comment
Share on other sites

@Thornhunt
You are missing the parameter $STR_ENTIRESPLIT in your StringSplit() function; it is needed if you are splitting a string with more characters as delimiter:

#include <Array.au3>
#include <StringConstants.au3>

Global $strString = 'IES     1 return {ap={tiles=",meta={build_version="343524"', _
       $arrSplit

$arrSplit = StringSplit($strString, 'meta=', $STR_ENTIRESPLIT)

If IsArray($arrSplit) Then _ArrayDisplay($arrSplit)

:)

Click here to see my signature:

Spoiler

ALWAYS GOOD TO READ:

 

Link to comment
Share on other sites

Ahhhh It was me then haha 

Cheers, will pop it in when I get home :)

 

thanks 

Budweiser + room = warm beerwarm beer + fridge = too long!warm beer + CO2 fire extinguisher = Perfect![quote]Protect the easly offended ... BAN EVERYTHING[/quote]^^ hmm works for me :D

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