Jump to content
drquochoai

How to convert a string likeArray to a array?

Recommended Posts

drquochoai

Thanks for your helping, even just see my question.

My problem is: I have a string like array like this:

[[["buộc dung tích sống t","forced vital capacity t"]],,"en",,,[["forced",1,[["buộc",872,true,false],["buộc phải",127,true,false],["bị buộc",0,true,false],["cưỡng bức",0,true,false],["bắt buộc",0,true,false]],[[0,6]],"forced vital capacity t",0,1],["capacity vital",2,[["dung tích sống",733,true,false]],[[7,21]],,1,4],["t",3,[["t",733,true,false],["tấn",0,true,false]],[[22,23]],,4,5]],0.10543188,,[["en"],,[0.10543188]]]

I've tried so much on forum to see how to convert it to an array of Autoit for getting his contents for 3 hours, but i could not.

Please help me with this!

Thanks for reading my question, please help me if you can.

Thanks again.

Edited by drquochoai

Share this post


Link to post
Share on other sites
TheSaint

To turn it into an array, you need some way to separate all the elements.

You could possibly use StringSplit and a comma.

The more detail you give, the better targeted help we can give.

Where are you getting the string from?

What are you using it for?

Edited by TheSaint

AutoIt.4.Life Clubrooms - Life is like a Donut (secret key)

Make sure brain is in gear before opening mouth!
Remember, what is not said, can be just as important as what is said.

Spoiler

What is the Secret Key? Life is like a Donut

If I put effort into communication, I expect you to read properly & fully, or just not comment.
Ignoring those who try to divert conversation with irrelevancies.
If I'm intent on insulting you or being rude, I will be obvious, not ambiguous about it.
I'm only big and bad, to those who have an over-active imagination.

I may have the Artistic Liesense ;) to disagree with you. TheSaint's Toolbox (be advised many downloads are not working due to ISP screwup with my storage)

userbar.png

Share this post


Link to post
Share on other sites
iamtheky

You should post an example of the result that is desired.  Here is a stab in the dark

#include<array.au3>

$sString = '[[["bu?c dung tích s?ng t","forced vital capacity t"]],,"en",,,[["forced",1,[["bu?c",872,true,false],["bu?c ph?i",127,true,false],["b? bu?c",0,true,false],["cu?ng b?c",0,true,false],["b?t bu?c",0,true,false]],[[0,6]],"forced vital capacity t",0,1],["capacity vital",2,[["dung tích s?ng",733,true,false]],[[7,21]],,1,4],["t",3,[["t",733,true,false],["t?n",0,true,false]],[[22,23]],,4,5]],0.10543188,,[["en"],,[0.10543188]]]'

$aString = stringregexp($sString , "\[[^\[].*?\]" , 3)

_ArrayDisplay($aString)

 


,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

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

×