C-Sharp | Java | Python | Swift | GO | WPF | Ruby | Scala | F# | JavaScript | SQL | PHP | Angular | HTML
C# String Join()The C# Join() methods is used to concatenate the elements of an array, using the specified separator between each element. It returns a modified string. Signature[ComVisibleAttribute(false)] public static string Join(String first, params String[] second) [ComVisibleAttribute(false)] public static string Joint(String, params Object[]) [ComVisibleAttribute(false)] public static string Join (String, IEnumerable<String>) [ComVisibleAttribute(false)] public static string Join(String, String[], Int32, Int32) [ComVisibleAttribute(false)] public static string Join<T>(String, IEnumerable <T>) Parameterfirst: it is a string type parameter. second: it is a string array. ReturnIt returns a string. C# String Join() Method Example
using System;
public class StringExample
{
public static void Main(string[] args)
{
string[] s1 = {"Hello","C#","by","TheDeveloperBlog"};
string s3 = string.Join("-",s1);
Console.WriteLine(s3);
}
}
Output: Hello-C#-by-TheDeveloperBlog
Next TopicC# String LastIndexOf()
|