Jump to content
UBot Underground

[SOLVED] Remove Single Item From List


Recommended Posts

I have a list... I want to remove a single word contained on one line of the list, and then close up the gap in the list it creates.

 

MyList:

(0) my;

(1) cat;

(2) is;

(3) very;

(4) cool;

 

I want to remove "very" ... But I can't do it through list position because the position changes with each run.

 

I have tried using remove/replace like it seems they would be used, but it throws an error. - I know this must be simple, but it's not letting me do it.

 

Any help is greatly appreciated.

Link to post
Share on other sites

something quick i came up with would be

 

ui text box("Delete Word From List", #deleteword)
add list to list(%test, $list from text("my
cat
is
very
cool", $new line), "Delete", "Global")
set(#stopme, 0, "Global")
set(#pos, 0, "Global")
loop while($comparison(#stopme, "=", 0)) {
    if($comparison($list item(%test, #pos), "=", #deleteword)) {
        then {
            remove from list(%test, #pos)
            set(#stopme, 1, "Global")
        }
        else {
            increment(#pos)
        }
    }
}

This works if the word you're looking to remove shows up only once in the list . If it show more then once you need to mode the above code a bit

Link to post
Share on other sites
  • 1 year later...

how about if I need to remove words from the list that not contain spesific words?

 

E.g

 

0. ubot

1. ubot

3. ubot

4. tubo

 

How remove tubo? I got stuck about it.

 

Thanks

Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...