2017년 8월 11일 금요일

how to remove parentheses when displaying lists?


Is there a way to remove the parentheses that appear around text when calling a list?
So im trying to put all text from a list into a label by; set textlable.text - and plugged into that is the global for the list. but the text displayed from the list is always surrounded by ( )
The way im doing it now is using the replace all and replacing all ( ) with nothing.
but surely there is a better way? i just cant figure it out.

--
Have you tried using a ForEach loop?

--
yeah, stevozip is right. use the [foreach] loop.
--
no i have not tried a foreach loop before, could you give a bit more information please? i tried a few things but no luck.

--
See attached for an alternative.
--
aah that is a better way of doing it, thanks hossein!

--
how do you use a foreach loop? I am trying to remove parentheses from displaying when stored data is recalled into a label to view.

--
assume your list is global items.

for each item - item(name)
lbloutput.text = make text item(Value)                                      \n(text)     
in list Items
Try that.

--
Thank you. Your solution work fine!.

--
Here's how I accomplished the task:
Consider the following objects:
The label at the bottom that shows the removed parentheses is named textResult.

I found that using Replace All will only remove one of the parentheses. Copying the same blocks with a second Replace All again will not remove the second ). 

So I Defined a variable named tempText as text "temp".
When you type in a string of text that includes (), and click button1, you tell it to take the text in TextBox1.text and first replace all "(" with "". The value of tempText will now be the string with all "(" removed. Then you tell it to take the resultant values that is now defined as tempText, and do a replace all ")" with "" and end up setting textResult.text as the string that has removed all ()'s. 

--

댓글 없음:

댓글 쓰기