c# - how to dissect string values -


How can I split or retrieve string values ​​

Here is the sample code that Is now working

  Private Zero Splittings () {List & lt; String & gt; Listvalues ​​= new list & lt; String & gt; (); Listvalues ​​= (list & lt; string & gt;) session ["mylist"]; String [] strvalues ​​= listvalues.ToArray (); (Int x = 0; x & lt; strvalues.Length; x ++) {}}  

Now I'am able to get list values ​​in my session, I How can I get a different value for each list using foreach or statement? What do I want to know depends on how much the list is that according to the program the values ​​of the wire are divided. If you have a list of string values, you can do the following:

  private Zero splittings () {list & lt; String & gt; ListValues ​​= (list & lt; string & gt;) session ["mylist"]; // Always check session values ​​for zero if (listValues! = Null) {// go through each list item foreach (string stringElement in listValues) {// variable 'stringElement' system.Console.WriteLine (stringElement) Do something with; }}}  

Note that I test the result of session casting and that I will not create a new list first, which is not necessary. Also keep in mind that I have not converted into an array, just because looping a list is really easy or just as easy, as an array.

Note that you have your way SplitStrings , but we are not distributing anything

Do you mean that the separator character Based on the four-element list, what is to be divided like "one; two; three; four"?

Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -