Search found 18 matches

by kimberlyn
Fri Jul 19, 2013 8:54 am
Forum: Talking LiveCode
Topic: Regex expression
Replies: 21
Views: 18020

Re: Regex expression

Oh thank you i didn't saw your answer !

May I ask a last question ?
Actually all this is very good. But when you have a line like this :
ITEM6,ATK,DFS,SPE,[GOF,30,33,0], 2, [FFG,12,13; PPT, 10, 0];

I m focusing on this part :
2, [FFG,12,13; PPT, 10, 0].

The "2" means that I have two ...
by kimberlyn
Fri Jul 05, 2013 9:27 am
Forum: Talking LiveCode
Topic: merge two arrays
Replies: 8
Views: 9688

Re: merge two arrays

Thanks !

Another question, how to I merge to strings ?
I have a table of strings. Each string is between 1 and 4 caracters, and I want them all to be 6 caracters long.

I've done that but it doesn't work :
put "agf" & cr after tab1
put "b" & cr after tab1
put "cggg" & cr after tab1

split tab1 ...
by kimberlyn
Fri Jul 05, 2013 1:42 am
Forum: Talking LiveCode
Topic: merge two arrays
Replies: 8
Views: 9688

Re: merge two arrays

I found this way :

Code: Select all

put the number of elements of tab2 into var
  repeat with i = 1 to the number of lines in the keys of tab1
     put tab1[i] into tab2[i+var]
  end repeat
by kimberlyn
Fri Jul 05, 2013 1:38 am
Forum: Talking LiveCode
Topic: merge two arrays
Replies: 8
Views: 9688

Re: merge two arrays

Well I just want to add the elements of tab1 into tab2

for example :
put "a" & cr after tab1
put "b" & cr after tab1
put "c" & cr after tab1

put "d" & cr after tab2
put "e" & cr after tab2
put "f" & cr after tab2

split tab1 with cr
split tab2 with cr --It's not the best way but in my ...
by kimberlyn
Thu Jul 04, 2013 11:47 pm
Forum: Talking LiveCode
Topic: merge two arrays
Replies: 8
Views: 9688

merge two arrays

Hi, I have to arrays containing strings tab1 and tab2.

I want to put the content of tab1 into tab2 but I have an error i can't fix :S !

Mu code is repeat with i = 1 to the number of lines in the keys of tab1
put tab1[i] after tab2
end repeat

I also tried
put the keys of tab1 into theKeys ...
by kimberlyn
Thu Jul 04, 2013 10:08 pm
Forum: Talking LiveCode
Topic: Regex expression
Replies: 21
Views: 18020

Re: Regex expression

up ! :)
by kimberlyn
Thu Jul 04, 2013 10:46 am
Forum: Talking LiveCode
Topic: Regex expression
Replies: 21
Views: 18020

Re: Regex expression

Well,

My file contains lines like this
ITEM1,10,3,50,ATK,DFS,SPE,[GOF,30,33,0];
ITEM1,10,3,50,ATK,DFS,SPE,[GOF,30,33,0;TTF,21,33,;JDK,10,20,45;...];
ITEM1,10,3,50,ATK,DFS,SPE,[GOF,30,33,0;FFG,12,13,,];
As you can see the format is always the same but the numbers of parameters into the "[]" can be ...
by kimberlyn
Wed Jul 03, 2013 8:56 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: working with files.
Replies: 13
Views: 10706

Re: working with files.

with this set of data in field "fOrigData":

ITEM1,10,3,50,ATK,DFS,SPE,[GOF,30,33,0];
ITEM2,1,0,,ATK,DFS,SPE,[GDF,30,60,1];
ITEM22,4,3,5,ATK,DFS,SPE,[GJF,
30,1200,300];
ITEM23,1,0,,ATK,DFS,SPE,[GHF,
100,0,10];
ITEM11;10;3;50;ATK;DFS;SPE;[GOF,30,33,0];
using this code in a button
on mouseUp
put ...
by kimberlyn
Wed Jul 03, 2013 7:27 pm
Forum: Talking LiveCode
Topic: Regex expression
Replies: 21
Views: 18020

Re: Regex expression



"^([^,]*?),([^,]*?,){6}\[([^,]*?,){3}[^,]*?;$"


And last, as you mentionned in another thread you need to get items 5 and 9,
you also could do it all in one:


if matchText(currentLine,"^([^,]*?),[^,]*?,[^,]*?,[^,]*?,([^,]*?),[^,]*?,[^,]*?,\[[^,]*?,([^,]*?),[^,]*?,[^,]*?;$",vITEM, v5, v9 ...
by kimberlyn
Wed Jul 03, 2013 1:42 pm
Forum: Talking LiveCode
Topic: Regex expression
Replies: 21
Views: 18020

Re: Regex expression

Yes but it's kinf of "dirty".

However, I found my solution :
repeat for each line currentLine in File
if matchText(currenLine, "(.*?),.*?,.*?,.*?,.*?,.*?,.*?,\[.*?,?.*?,?.*?];$", vITEM) then
answer vITEM
end if
end repeat
This takes the first item of my line (with the "()") and store it into ...
by kimberlyn
Wed Jul 03, 2013 12:33 pm
Forum: Getting Started with LiveCode - Complete Beginners
Topic: working with files.
Replies: 13
Views: 10706

Re: working with files.

Well, while you helped me I worked and I also put the delimiter as ";". It works fine for this file.

But it's not finished yet :(
In fact I use two files, and the second one is a bit different in its content :

ITEM1;10;3;50;ATK;DFS;SPE;[GOF,30,33,0]; --it's an example
In this case I cannot use ...
by kimberlyn
Wed Jul 03, 2013 12:26 pm
Forum: Talking LiveCode
Topic: Regex expression
Replies: 21
Views: 18020

Re: Regex expression

Hi,

I've thought about that. But it is not that simple because the file sometimes is in the format (and I can't change it):
ITEM1,10,3,50,ATK,DFS,SPE,[GOF,30,33,0];
ITEM2,1,0,,ATK,DFS,SPE,[GDF,30,60,1];
ITEM3,23,1,100,ATK,DFS,SPE,[
GUF,,99,12];
ITEM4,1,90,21,ATK,DFS,SPE,[
GDF,30,,12];
So if I ...
by kimberlyn
Wed Jul 03, 2013 9:53 am
Forum: Getting Started with LiveCode - Complete Beginners
Topic: working with files.
Replies: 13
Views: 10706

Re: working with files.

In fact my file contains ligns of data like this.
ITEM1,10,3,50,ATK,DFS,SPE,[GOF,30,33,0];
ITEM2,1,0,,ATK,DFS,SPE,[GDF,30,60,1];

but sometimes they are "cut" like this
ITEM22,4,3,5,ATK,DFS,SPE,[GJF,
30,1200,300];
ITEM23,1,0,,ATK,DFS,SPE,[GHF,
100,0,10];

and my code is :
open file File for ...
by kimberlyn
Wed Jul 03, 2013 9:23 am
Forum: Talking LiveCode
Topic: Regex expression
Replies: 21
Views: 18020

Regex expression

Hello everyone,

Today I have kind of an issue. I have a file containing ligns of values and expressions like :

ITEM1,10,3,50,ATK,DFS,SPE,[GOF,30,33,0];
ITEM2,1,0,,ATK,DFS,SPE,[GDF,30,60,1];
you will notice that if there is no value, the field is empty.

and my code is like :

open file File ...
by kimberlyn
Wed Jul 03, 2013 9:10 am
Forum: Talking LiveCode
Topic: sort an array with alphabet
Replies: 4
Views: 5137

Re: sort an array with alphabet

Hi,

I'm going to look deeper into that question.
Thanks for your help. At these moments I'm realizing that even LiveCode isn't that perfect :p