Menu
Newbedev LogoNEWBEDEV Python Javascript Linux Cheat sheet
Newbedev LogoNEWBEDEV
  • Python 1
  • Javascript
  • Linux
  • Cheat sheet
  • Contact

c# remove last character from string if is blank space code example

Example 1: c# remove last character from string

string Name = "Teste,"
string ReturnName = "";
ReturnName = Name.Remove(Name.Length - 1);

Example 2: remove last instance of string c#

public static string ReplaceLastOccurrence(string Source, string Find, string Replace)
{
        int place = Source.LastIndexOf(Find);

        if(place == -1)
           return Source;

        string result = Source.Remove(place, Find.Length).Insert(place, Replace);
        return result;
}

Tags:

Javascript Example

Related

css images flexbox code example javascript set transform code example laravel one to many relationship with pivot table with data code example minecraft uhc plugin code example selected blue border with highlights code example If array empty C code example how to start the basic node js applications code example How to install jdk version 8 on raspberrypi code example ng install javascript code example comment in css sheet code example trimming enter character in swift code example laravel consume api code example

Recent Posts

Pandas how to find column contains a certain value Recommended way to install multiple Python versions on Ubuntu 20.04 Build super fast web scraper with Python x100 than BeautifulSoup How to convert a SQL query result to a Pandas DataFrame in Python How to write a Pandas DataFrame to a .csv file in Python
© 2021 newbedevPrivacy Policy