I was wondering if you guys could give me a hand with this. 

I'm creating a HTML editor and I have come across this problem. I look
at each char in the text and place what it is in a list like what you
see below.

** Now I need to find in each list the ones with matching numbers and
combine them. 

My two lists:

List1 = ["<text align="right">": 0, "<text align="left">": 10]
List2 = ["</text>": 10, </text>": 19]

What I need is:

List3 = ["<text align="right">": 0, "</text><text align="left">":10,
"</text>": 19]

As you can see now Number 10 in List1 and List2 are combined in List3.

What I have done so far:

on combineLists  
  
  set numFeatures1 =count(list1)
  set numFeatures2 =count(list2)
  
  
  if numFeatures1 > numFeatures2 then
    numFeatures = numFeatures1
  else
    numFeatures = numFeatures2
  end if
  
  newlistAlign = [:]
  
  repeat with x = 1 to numFeatures 
    
    if x > numFeatures1 then
    else
      set item1 =getAt(list1, x) --Num 
      set type1 =getPropAt(list1, x) --Tag
    end if 
    
    if x > numFeatures2 then
    else
      set item2 =getAt(list2, x)--Num
      set type2 =getPropAt(list2, x)--Tag
    end if
    
    if item1 = item2 then
      newEntery = type1 & type2
      addProp newlist, newEntery, item2 
    end if 
    
    if item1 <> item2 then
      newEntery = type1
      newEntery2 = type2
      addprop newlist, newEntery,  item1
      addprop newlist, newEntery2, item2 
    end if

  end repeat
  
end    


Problem is I get this: 
["<text align="right">": 0, "</text>": 10, "<text align="left">": 10,
"</text>": 19]

Thanks,
Matt



[To remove yourself from this list, or to change to digest mode, go to 
http://www.penworks.com/lingo-l.cgi  To post messages to the list, email [EMAIL 
PROTECTED]  (Problems, email [EMAIL PROTECTED]). Lingo-L is for learning and helping 
with programming Lingo.  Thanks!]

Reply via email to