String joins : String Split Join : String C# Examples


C# Examples » String » String Split Join »

 

String joins









    
using  System;  
  
class  MainClass  {  
    public  static  void  Main()  {  
        string  str  =  "while  if  for,  public  class  do.";  
        char[]  seps  =  {'  ',  '.',  ','  };  
  
        //  Split  the  string  into  parts.  
        string[]  parts  =  str.Split(seps);  
        
        string  whole  =  String.Join("  |  ",  parts);  
        Console.WriteLine("Result  of  join:  ");  
        Console.WriteLine(whole);  

        
    }  
}
    
   
  
   



Output

Result of join:
while | if | for |  | public | class | do |


HTML code for linking to this page:

Follow Navioo On Twitter

C# Examples

 Navioo String
» String Split Join