Enigma 78 Posted September 6, 2013 Report Share Posted September 6, 2013 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: abcde 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. Quote Link to post Share on other sites
LazyBotter 188 Posted September 6, 2013 Report Share Posted September 6, 2013 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) } Quote Link to post Share on other sites
Enigma 78 Posted September 6, 2013 Author Report Share Posted September 6, 2013 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. Quote Link to post Share on other sites
Enigma 78 Posted September 6, 2013 Author Report Share Posted September 6, 2013 Nevermind, I think i have found the solution.Thanks for your time anyway Quote Link to post Share on other sites
LazyBotter 188 Posted September 6, 2013 Report Share Posted September 6, 2013 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) } ? Quote Link to post Share on other sites
Enigma 78 Posted September 6, 2013 Author Report Share Posted September 6, 2013 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 #StringThanks Quote Link to post Share on other sites
Pete 121 Posted September 6, 2013 Report Share Posted September 6, 2013 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") Quote Link to post Share on other sites
UBotDev 276 Posted September 6, 2013 Report Share Posted September 6, 2013 If you have items in a list you could also use "$text from list" function to replace the loop in your code. Quote Link to post Share on other sites
Enigma 78 Posted September 6, 2013 Author Report Share Posted September 6, 2013 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. Quote Link to post Share on other sites
pftg4 102 Posted September 6, 2013 Report Share Posted September 6, 2013 $text from list is what you need Quote Link to post Share on other sites
UBotDev 276 Posted September 6, 2013 Report Share Posted September 6, 2013 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. Quote Link to post Share on other sites
Enigma 78 Posted September 7, 2013 Author Report Share Posted September 7, 2013 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. Quote Link to post Share on other sites
UBotDev 276 Posted September 7, 2013 Report Share Posted September 7, 2013 Sorry, I meant connector not delimiter, which is a parameter of function "$text from list". Quote Link to post Share on other sites
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.