Jump to content
UBot Underground

Command similar to PHP's explode?


Recommended Posts

Hi everyone!

 

I was wondering if anyone had a good way to implement a function similar to the explode mechanism in PHP?

 

For example, if I have a sentence of items:

apples, oranges, pears

 

And I want to turn it into a list:

(0) apples

(1) oranges

(2) pears

 

How would I go about implementing this? It might be something simple I'm missing. Any help would be appreciated!

Link to post
Share on other sites
ui text box("List", #list)
ui button("Add") {
    add list to list(%list, $list from text(#list, ","), "Delete", "Global")
    set(#list, "", "Global")
}

 

Here's a simple example. Add the string "apples,oranges,pears" to the text box, hit "add" and done. View > Debugger to see it populate the list. 

text_to_list.ubot

  • Like 2
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...