scion 0 Posted February 23, 2010 Report Share Posted February 23, 2010 Hello All, Okay...I'm trying to take a list of items and format them into spin ready format. So if for example the list was... blue redgreenyellow I'm trying to have it take the list, put everything on one line, separated by pipes with brackets at beginning and end. So final output would look like this {blue|red|green|yellow} Currently I'm creating a list from a file that contain all the words. But that's as far as I can get. I'm not sure how to have it write each element to a line as well as place the pipes and brackets. Anyone have any ideas? Thanks! Quote Link to post Share on other sites
some_guy 11 Posted February 23, 2010 Report Share Posted February 23, 2010 read file to listset #str = {loop listotal set #item to nextListItem set #str = #str| after loop use javascript (lib_string) to return a substring of #str (0, length -1), so you remove the last |set #str = #str} Quote Link to post Share on other sites
scion 0 Posted February 24, 2010 Author Report Share Posted February 24, 2010 read file to listset #str = {loop listotal set #item to nextListItem set #str = #str| after loop use javascript (lib_string) to return a substring of #str (0, length -1), so you remove the last |set #str = #str} Thanks for your reply. The above code is a bit beyond me but I tried to use it as far as I could... I've attached the bot I created minus the java portion as I know nothing about javascript.I am getting an output of a list without any {'s or |'s. Sorry for my ignorance... Obviously this bot is set to open a file on my system...that would have be be changed with your own...joiner.ubot Quote Link to post Share on other sites
bluegoat 24 Posted February 26, 2010 Report Share Posted February 26, 2010 This should do it. If your .txt file doesn't end in a "new line" your text might be missing the last character since it's replacing "new line" with "|" In this case just remove the node with thejavascript that strips the last character. Have funspin text.ubot 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.