Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
C# program to separate joined strings in C#
The following is the string array −
string[] str = { "Java", "AngularJS", "Python", "jQuery", "HTML5" };
Firstly, join it −
string.Join(" ", str);
Now to separate the above joined strings, use the Split() method as shown in the following code −
Example
using System;
public class Demo {
public static void Main() {
string[] str = { "Java", "AngularJS", "Python", "jQuery", "HTML5" };
// join words
string res = string.Join(" ", str);
Console.WriteLine("Joined Strings...
"+res);
string[] convert = res.Split(' ');
Console.WriteLine("
Separate Joined Strings...");
foreach (string val in convert) {
Console.WriteLine(val);
}
}
}
Output
Joined Strings... Java AngularJS Python jQuery HTML5 Separate Joined Strings... Java AngularJS Python jQuery HTML5
Advertisements