C# Strings
String class in .NET and C# represents strings. On this page, there is a list of code examples and tutorials related to strings in C#. Learn string concatenation, trim strings, replace strings, remove strings, and effective use of strings using StringBuilder class in C#.

RECENT POSTS

  • Generate Random Number And Random String In C#

    The Random.Next() method returns a random number in C#. The Random class's RandomByte and RandomDouble method returns a random byte and and a random double integer. The code examples show how t...
  • Add, Remove, Replace Strings In C#

    This code snippet shows how to add, remove and replace strings in C# and .net core. Insert method in C#, Remove method in C#, Replace method in C#, Split method in C#.
  • Padding Strings In C#

    This code snippet shows how to pad strings in C# and .net core. Padding in string is adding a space or other character at the beginning or end of a string. String class has String.PadLeft() and Str...
  • Programming Strings In C#

    Strings are a common part of C# programming language. String class and string type represent strings in .NET. The code examples in this tutorial demonstrates how to use strings, format strings, com...
  • StringBuilder C#

    Both String and StringBuilder objects contain Unicode characters of type Char and support an indexer that returns Char. StringBuilder i useful for multiple string manipulation operations. The code ...
  • StringBuilder and String Concatenation

    StringBuilder class in .NET Core and C# offers string modifications methods including Replace String, Concatenate Strings, Remove Strings, and modify strings. The code samples in this article demo ...
  • Trim String in C#

    String.Trim(), String.TrimStart(), and String.TrimEnd() methods provide trim string functionality in C# and .NET. The Trim method removes white spaces from the beginning and endof a string. The Tr...
  • Use Of String.Format() To Format Strings In C#

    This code snippet shows how to format strings in C# and .net core. You can use the Format method to create formatted strings and concatenate multiple strings representing multiple objects. The Form...
  • Understanding String Interpolation In C#

    The string interpolation feature in C# and .NET allows an easier way to format and manipulate strings. This feature was introduced in C# 6. Using string interpolation, we can use objects and expres...
  • 6 Effective Ways To Concatenate Strings In C# and .NET Core

    Adding strings is a common operation in C# and .NET. The String class provides several ways to add, insert, and merge strings including + operator, String.Concate(), String.Join(), String.Format(),...
  • String Compare In C#

    The code examples compare strings in C# using String.Equals, String.Compare, String.CompareTo() method, and StringComparer. String compare in .NET and C# .
  • Split String In C#

    The code examples in this tutorial demonstrates how to Split Strings in C#. Code examples for Splitting Strings use String.Split() method to separate strings based on character delimiter, string de...
  • Uppercase and Lowercase Strings in C#

    C# String has ToUpper() and ToLower() methods to convert a string to uppercase and lowercase. This sample code demonstrates how to convert a string into lowercase string or uppercase string in C#.
  • Differences Between Text, Stream, String and Binary Data

    This article provides an overview of the differences between Text, Stream, String and Binary Data and related classes to stream.
  • Finding Directories With Regular Expressions

    This article provides an example of using a regular expression to search a directory and determine a file type. C# Regular Expressions
  • Checking Birthday By Regular Expression

    This example tries to check birthday using Regular Expression
  • Convert A String To Title Case In C#

    There is no direct method like ToUpper(), ToLower() for Title Case. But using CultureInfo and TextInfo classes we can do Title case of a string.
  • Copy And Concatenate String In C#

    This code snippet shows how to copy and concatenate strings in C# and .net core. The Concat method adds strings (or objects) and returns a new string. Using Concat method, you can add two strings, ...
  • StringCollection in C#

    StringCollection class is a new addition to the .NET Framework class library that represents a collection of strings. In this article, we will discuss how to take advantages of its methods and prop...
  • 7 Way to Use the C# SubString Method (Examples)

    A substring in C# is a contiguous sequence of characters within a string. This article and code examples demonstrate how to retrieve a C# Substring using String.Substring method using C# and .NET C...
  • How To Convert A Byte Array To A String In C#

    This code snippet is example of how to convert a byte array to a string using C# and .NET Core and convert a string to a byte array.
  • Select Random String From An Array In .NET Core and C#

    This article demonstrates how to pick a random string an array of strings.
  • Enhancing Console Output With Underlining, Colors And More

    With the rise of .Net Core, GUI-less Console applications have come back into popular usage which is perfectly fine. It’s just that they’re so bland; black and white and basic text when sometimes ...
  • Split Line Based on Given Set of Sub Strings

    In this blog you will learn how to split the line based upon a given set of sub strings which is available in the line.
  • Regular Expression Character Classes

    List of characters used by Regular Expression.