Remove letters from elements in a list OR Import a csv file into a list without ( )


#1

Hey there,

I just imported a .csv file into a list. During the process ( and ) where added to each element in the list. Is it possible to remove them? Otherwise I can’t use the list

Thanks for your help!


#2

You should be able to select a list item index, which would return ONLY the value in that index. But if for whatever reason the list value is something like:

  • index1: (value1)
  • index2: (value2)
  • index3: (value3)

Where the values include parenthesis, then you can use the “replace all text” block each time you grab a list item. Or you can create a procedure that replaces all the ( & ) from the csv list and re-writes the list without the parenthesis.

Hope that makes sense. If you’d like an example just let me know. You can post a screenshot of what you’re having trouble with specifically, and I can tailor the example based on the problem.


#3

This is what I made so far:

A example output would be as follow:
(dog)
(cat)
(mouse)
(cheese)

I just need the parenthesis removed, when I set the text of the label.

I would be very grateful for an example!


#4

https://groups.google.com/forum/#!msg/mitappinventortest/pr2pZ991Suk/T6_oQfD1BwAJ
is this what you want?


#5

@Billla you can use TextUtils which includes a versatile regex block. It’ll allow you to remove numbers from string using one block


#6

for 1 column csv tables: instead of using the list from csv table block use the split block and split at \n (new line) to convert the csv file into a list

Taifun


#7

I switched the list from csv table to a split block, but the list just puts it all into one item:

dogcatmousecheese

Did I something wrong?


#8

Unbenannt


#9

Thank you very much! It worked.

And thanks for your effort @PixiiBomb


#10

Glad you got it figured out!


#11

Hi, me again.

Is it also possible to create a list from a .txt file, which is saved on a webspace?

From something like this, for example:
http://ni1125254-3.web04.nitrado.hosting/list.txt

Thank you!


#12

Yes. You can use web component and point to url to get the text. It will trigger GotText event. In that block you’ll have to split the text by carriage return: \n


#13

I can’t find the WebViewer GotText Event block. Or am I in the wrong tab?


#14

the web component is different from the webviewer component…
How to download a file and save it on your device
Taifun


#15

Oops, my bad. Thank you for your help!