Abundant Code

  • C#
  • C++
  • Elastic Search
  • Entity Framework
  • F#
  • JavaScript
  • ASP.NET
  • C
  • Java
  • SQL Server
  • Assembly Lang
Home ยป string

How to get last four characters from a string in C#?

November 27, 2020 by AbundantCode Leave a Comment

This post will provide a simple tip showing how you can get the last 4 characters from a string in C#.

How to get last four characters from a string in C#?

Assume that you have a string that contains …

Filed Under: C# Tagged With: C#, string

How to repeat a string N number of times in C# ?

February 12, 2016 by AbundantCode 3 Comments

Do you want to repeat a string N number of times in C# ? . You can use the string.concat and Enumerable.Repeat to achieve it in .NET Framework 4.0 and higher.

How to repeat a string N number of times

…

Filed Under: C# Tagged With: Enumerable, How to, string, tips

Case insensitive string comparison for Contains in C#

October 6, 2015 by AbundantCode Leave a Comment

When using the string.contains method , the comparison is done based on the exact string that is passed as parameter. In this case , the comparison is case-sensitive.

using System;
namespace ACConsoleApp
{
    class Program
    {
        static void Main(string[] args)
        
…

Filed Under: C# Tagged With: C#, comparison, How to, string, tips

How to Populate XDocument from String in C# ?

June 10, 2015 by AbundantCode Leave a Comment

To populate the XDocument from a string in C# , we can use the Parse method defined in the XDocument class.

Below is a sample code snippet that demonstrates how to populate XDocument from string in C#.

How to Populate

…

Filed Under: C# Tagged With: csharp, string, XDocument, XML

Writing the String to the Output Window in Visual Studio 2013

December 31, 2013 by AbundantCode Leave a Comment

Below is a sample code snippet that demonstrates how to write a string to the Output Windows in Visual Studio 2013.

Writing the String to the Output Window in Visual Studio 2013

using System;
using System.Collections.Generic;
using System.Data;
using System.IO;
…

Filed Under: Visual Studio Tagged With: Immediate, Output Window, string, Visual Studio 2013, Window

How to Get the Maximum value from a List of String using LINQ in C# ?

December 31, 2013 by AbundantCode Leave a Comment

In one of the previous article , we explained how to get the maximum value from a list of integer using LINQ query in C# . What happens when the column is a string instead of integer ?. Below are …

Filed Under: C# Tagged With: C#, How to, LINQ, List, Maximum, string, value

How to remove non alphanumeric characters (special characters) from a string in C# ?

December 30, 2013 by AbundantCode Leave a Comment

One of the simplest way to remove non alphanumeric characters from a string is using the regular expressions . Below is a sample code snippet that demonstrates how to delete the non alphanumeric characters from a string in C#.

How

…

Filed Under: C# Tagged With: alphanumeric, C#, How to, regular expression, remove, string

Count the Occurrences of String within another String in C#

October 14, 2013 by AbundantCode 2 Comments

Do you want to find the number of occurrences of a string within a string in C#? This article will explain how to do it.

How would you count occurrences of a string within a string (C#)?

For example, assume …

Filed Under: C# Tagged With: C#, Count, How to, Occurrences, string

Concatenate or Join a string Array using LINQ in C#

August 15, 2013 by AbundantCode Leave a Comment

Want to join the items inside the string array say with, delimiter using LINQ in C#? It’s pretty easy.

Below is a sample code snippet demonstrating in easy steps on how to concatenate a string array using LINQ in C#?…

Filed Under: C# Tagged With: Array, C#, concatenate, Join, LINQ, string, tutorials

How to reverse a string in C#?

August 7, 2013 by AbundantCode Leave a Comment

Below is a sample code snippet demonstrating on how to reverse a string in C#?

How to reverse a string in C#?

string str = "Abundantcode";

char[] cArray = str.ToCharArray();

Array.Reverse(cArray);
…

Filed Under: C# Tagged With: C#, How to, reverse, string

  • 1
  • 2
  • Next Page »
RSS
Facebook
fb-share-icon
Twitter
Visit Us
Follow Me
Tweet

Recent Posts

  • InvalidModuleDescriptorException when running java program in Eclipse IDE
  • Python Program to Check Armstrong Number
  • Collapsible links for subcategories in Docusaurus Sidebar
  • Python Program to Print Fibonacci Series
  • Python Program to Generate Multiplication Table

Categories

Tags

.NET App Array ASP.NET ASP.NET MVC Assembly Language C# C# programs c lab programs Collection convert C program csharp database Example F# guide How to How to in Java integer Java Javascript Lab programs Lambda LINQ List Python lab programs Python programs SIC/XE SQL Server string tips tricks tutorial tutorials UWP visual studio 2015 Windows Windows 8 Windows 10 Windows Phone Windows Phone 8 Windows Phone 8.1 wp8 XAML

Blog Stats

  • 8,747,455 hits

Archives

Top Posts & Pages

  • How to Convert a Stream to Byte Array in C# 4.0 ?
  • How to Allow only numeric input in a Textbox in WPF ?
  • How to Quickly Delete All Rows in a Table in Entity Framework?
  • How to open display settings from command line in Windows 10 ?
  • C Program to display half-pyramid using alphabets
  • How to Calculate MD5 checksum for a file in C# ?
  • System Software - SIC/XE Program to divide BETA by GAMMA and set quotient and remainder
  • How to clean up unused PowerPoint master slides in PowerPoint?
  • How to Extract number from a string using C# ?
  • How to retrieve the URL of the current Page in ASP.NET MVC 4 Controller ?

Categories

  • Android
  • Angular 2
  • ASP.NET
  • Assembly Language
  • C
  • C#
  • C++
  • Elastic Search
  • Entity Framework
  • Excel
  • F#
  • HTML
  • Interview Questions
  • Java
  • JavaScript
  • jQuery
  • Microsoft Office
  • MySQL
  • NETWORK
  • News
  • PHP
  • popular
  • PowerShell
  • Python
  • Ruby
  • SharePoint
  • SQL Server
  • SQL Server
  • Unix
  • VB.NET
  • Visual Studio
  • WebAPI
  • Windows
  • Windows Azure
  • Windows Forms
  • XAML

Top Posts & Pages

  • How to Convert a Stream to Byte Array in C# 4.0 ?
  • How to Allow only numeric input in a Textbox in WPF ?
  • How to Quickly Delete All Rows in a Table in Entity Framework?
  • How to open display settings from command line in Windows 10 ?
  • C Program to display half-pyramid using alphabets
  • How to Calculate MD5 checksum for a file in C# ?
  • System Software - SIC/XE Program to divide BETA by GAMMA and set quotient and remainder
  • How to clean up unused PowerPoint master slides in PowerPoint?
  • How to Extract number from a string using C# ?
  • How to retrieve the URL of the current Page in ASP.NET MVC 4 Controller ?

Recent Posts

  • InvalidModuleDescriptorException when running java program in Eclipse IDE
  • Python Program to Check Armstrong Number
  • Collapsible links for subcategories in Docusaurus Sidebar
  • Python Program to Print Fibonacci Series
  • Python Program to Generate Multiplication Table
  • Python Program to Find the Factorial of a Number
  • Python Program to Print Prime Numbers in a Given Interval
  • Python Program to Check Prime Number
  • Python Program to Find the Largest Value Among Three Numbers
  • Python Program to Check If a Given Year is Leap Year

Tags

.NET App Array ASP.NET ASP.NET MVC Assembly Language C# C# programs c lab programs Collection convert C program csharp database Example F# guide How to How to in Java integer Java Javascript Lab programs Lambda LINQ List Python lab programs Python programs SIC/XE SQL Server string tips tricks tutorial tutorials UWP visual studio 2015 Windows Windows 8 Windows 10 Windows Phone Windows Phone 8 Windows Phone 8.1 wp8 XAML