Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PYTHON

ring convert string lines to list items and convert the list to a string

/* output:
** Items : 4
** Item : Hello
** Item : How are you ?
** Item : are you fine ?
** Item : ok
** list2Str result = Hello
** How are you ?
** are you fine ?
** ok
** Done
*/

mystr = "Hello
How are you ?
are you fine ?
ok"

mylist = str2list(mystr)
see "Items : " + len(mylist) + nl

for x in mylist
        see "Item : " + x + nl
next

newstr = list2str(mylist)
see "list2Str result = " + newstr

if mystr = newstr
        see nl + "Done"
else
        see nl + "Error!"
ok
Source by ring-lang.github.io #
 
PREVIOUS NEXT
Tagged: #ring #convert #string #lines #list #items #convert #list #string
ADD COMMENT
Topic
Name
7+7 =