Search
 
SCRIPT & CODE EXAMPLE
 

CSHARP

c# remove word from string

public static string RemoveHTML(string text)
{
    text = text.Replace(" ", " ").Replace("<br>", "
").Replace("description", "").Replace("INFRA:CORE:", "")
        .Replace("RESERVED", "")
        .Replace(":", "")
        .Replace(";", "")
        .Replace("-0/3/0", "");
        var oRegEx = new System.Text.RegularExpressions.Regex("<[^>]+>");
        return oRegEx.Replace(text, string.Empty);
}
Comment

Remove words string C#

string TrimWordsFromString(string value, int numberOfWords, char separator, bool reverse)
{
	int trimmedWords = 0;
    int index = 0;
    
    while(trimmedWords != numberOfWords)
    {
    	if(value == string.Empty)
        {
        	return string.Empty;
        }
        
        if(reverse)
        {
        	index = value.Length - 1;
        }
        
        if(value[index] == separator)
        {
        	trimmedWords++;
        }
        
        value = value.Remove(index, 1);
    }

    return value;
}
Comment

c# Remove String In C#

//The following example removes all characters from a string that are after 25th position in the string.

string founder = "Mahesh Chand is a founder of C# Corner";  
// Remove all characters after first 25 chars  
string first25 = founder.Remove(25);  
Console.WriteLine(first25);  
//************************************   ^_*
//The following example removes 12 characters from the 10th position in the string.

// Remove characters start at the 10th position, next 12 characters  
String newStr = founder.Remove(10, 12);  
Console.WriteLine(newStr);  
Comment

PREVIOUS NEXT
Code Example
Csharp :: dotnet automapper.extensions.microsoft.dependencyinjection 
Csharp :: how to set picturebox width with form width in c# 
Csharp :: calculate how much memory an object take c# 
Csharp :: dictionary in c# unity 
Csharp :: lcm of list of number 
Csharp :: c# radio button checked 
Csharp :: vector3 unity 
Csharp :: or in if statement c# 
Csharp :: c# how to check if a array bool is all true 
Csharp :: how to check type c# 
Csharp :: get processor id c# web application 
Csharp :: multi line comment c# 
Csharp :: what are access modifiers in c# 
Csharp :: c# char 
Csharp :: bundle.config in mvc is missing 
Csharp :: unity c# struct 
Csharp :: c# get function name 
Csharp :: columndefinition wpf 
Csharp :: c# wpf image source from resource programmatically 
Csharp :: add row and columns to grid wpf in code 
Csharp :: pyautogui not odwnloading 
Csharp :: C# bitwise operation 
Csharp :: Sort ListBox numerically in C# 
Csharp :: parse strings into words C# 
Csharp :: entity framework core genetare class using existing database 
Csharp :: c# how to call methods from another class 
Csharp :: array declaration in c# 
Csharp :: switch statement c# example 
Csharp :: C# domain name to ip address 
Csharp :: c# export datatatble to excel 
ADD CONTENT
Topic
Content
Source link
Name
9+5 =