Jump to content
UBot Underground

Making 1 string from multiple items


Recommended Posts

I want to figure out a way to make 1 string from multiple items in a list.

 

What i want to achieve is the following example:

 

a

b

c

d

e

 

 

Now i want it to become:

 

abcde

 

Thus make 1 single string from multiple items in a list.

 

Does anyone have a way to do it?

Thanks in advance.

Link to post
Share on other sites

clear list(%Items)
add list to list(%Items, $list from text("a,b,c,d,e,f,g,h,i,j,k", ","), "Delete", "Global")
set(#Pos, 0, "Global")
loop($list total(%Items)) {
set(#String, "{#String}{$list item(%Items, #Pos)}", "Global")
increment(#Pos)
}

Link to post
Share on other sites
clear list(%Items)
add list to list(%Items, $list from text("a,b,c,d,e,f,g,h,i,j,k", ","), "Delete", "Global")
set(#Pos, 0, "Global")
loop($list total(%Items)) {
    set(#String, "{#String}{$list item(%Items, #Pos)}", "Global")
    increment(#Pos)
}

 

Sorry i haven't been clear.

I have scraped stuff thus not adding "abcde" manually (it can be anything) plus it's not comma separated.

Link to post
Share on other sites
ui block text("Your Scraped Data: (Per Line)", #Items)
ui stat monitor("String:", #String)
set(#String, "", "Global")
clear list(%Items)
add list to list(%Items, $list from text(#Items, $new line), "Delete", "Global")
set(#Pos, 0, "Global")
loop($list total(%Items)) {
    set(#String, "{#String}{$list item(%Items, #Pos)}", "Global")
    increment(#Pos)
}
 

Link to post
Share on other sites
ui block text("Your Scraped Data: (Per Line)", #Items)
ui stat monitor("String:", #String)
set(#String, "", "Global")
clear list(%Items)
add list to list(%Items, $list from text(#Items, $new line), "Delete", "Global")
set(#Pos, 0, "Global")
loop($list total(%Items)) {
    set(#String, "{#String}{$list item(%Items, #Pos)}", "Global")
    increment(#Pos)
}
 

 

 

This part fixed it for me (from your first post)

set(#String, "{#String}{$list item(%list, #Pos)}", "Global")
increment(#Pos)

In fact, i didn't thought of re-using the existing values in #String

Thanks ;)

Link to post
Share on other sites


navigate("http://www.ubotstudio.com/forum/index.php?/topic/14832-making-1-string-from-multiple-items/", "Wait")
set(#AE, $replace regular expression($replace regular expression($page scrape("<p>What i want to achieve is the following example:</p>
<p> </p>", "<p> </p>
<p> </p>"), "<(style|script)[^<>]*>.*?</\\1>|</?[a-z][a-z0-9]*[^<>]*>|<!--.*?-->", $nothing), $new line, $nothing), "Global")

 

Link to post
Share on other sites

If you have items in a list you could also use "$text from list" function to replace the loop in your code.

 

Please explain.

Test from list, as far as i know, is for CSV files or text files that have a comma as separator.

Link to post
Share on other sites

Please explain.

Test from list, as far as i know, is for CSV files or text files that have a comma as separator.

You can use any custom separator with that function. It will convert list to string with delimiter you chose.

Link to post
Share on other sites

You can use any custom separator with that function. It will convert list to string with delimiter you chose.

 

I know, but there is no delimiter.

I scraped the data and it's just a list containing characters each on its own line.

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...