3
I have a string that looks like this:
Yeah, No, Maybe
And I have a code that I need to put these string results separately into a <option>
of a <select>
.
I intend to do this through a for()
. but I need to count the results of my split to put there, for example, picking up this string, would be:
Yes No Maybe
the results of a string.Split(",");
. But I need the number of how many results they gave, which in this case would be 3.
1: Sim
2: Não
3: Talvez
How do I count how many results I got in a split?
I’m doing on . NET and I tried to put a .Count
to see if it stuck, but it didn’t... how do I do it?
Hmm... worked. Just one more question. Do you know how I change your order? For example, in this case it would be
Sim Não Talvez
, but there was some way I could leave the order like thisTalvez Não Sim
?– edro
It is already another question, to stir up the order needs to know what is the condition you stipulated for this to happen, you want the
array
in reverse ??? what is the rule– novic
yes.. the array in reverse only
– edro
makes it from the largest to the smallest, example
for(int i = textos.Length - 1; i >= 0;i--){}
– novic
or use
Array.Reverse(textos)
and print normally ... I will not put in the answer because it is not part of the question ...– novic
Thank you, you’ll help me.
– edro