3

Deletion of a specific word in the repeater

 3 years ago
source link: https://www.codesd.com/item/deletion-of-a-specific-word-in-the-repeater.html
Go to the source link to view the article. You can view the picture content, updated content and better typesetting reading experience. If the link is broken, please click the button below to view the snapshot at that time.
neoserver,ios ssh client

Deletion of a specific word in the repeater

advertisements

I'm trying to remove a specified word/line from a string in a repeater and cut the length of the string

  public static string CutTextLength(string text)
    {
        if (text.Length > 400)
        {
            text = text.Substring(0, 400) + "...";
            Regex.Replace(text, "<br />", "");
        }
        return text;
    }

<div class="JobContent"><%#CutTextLength(Eval("Text").ToString()) %></div>

When running this code i'm only reducing the length of the string but not removing all the <"br /"> tags in the string. Can anyone help me with my problem?


You should do:

text = Regex.Replace(text, "<""br /"">", "");

because Replace doesn't alter text but returns a new string with the replacements.

Edit

On close reading your question I discovered you want to remove <"br /">. The above, updated statement should do the job.

Tags regex

Related Articles

Deleting rows containing specific words in a text file to Ruby

I have a text file like this: User accounts for \\AGGREP-1 ------------------------------------------------------------------------------- Administrator users grzesieklocal Guest scom SUPPORT_8855 The command completed successfully. First line is emp

Is there a way to classify an ID according to a specific word in the ID name?

Is there a way to style an ID based on a specific word in the ID name? If I have something like this: <div id="name-of-id.1234">Something</div> <div id="name-of-id.5678">Something</div> <div id="name-of-

Select specific words in the string that are not surrounded by quotation marks

I have a string something like this: As, we know that development of "the" nation depends on people as well as government of the country. I need a regex to detect specific word say 'the' not enclosed in double quotes. After some random tries I f

Delete packages contain a specific word in the name

In Linux (Fedora), how I see all the installed packages which contain a certain words in the package name. Then, remove all these packages installed.Fedora is an RPM-based distribution. So you'll want to use the rpm or yum commands. To list installed

Deleting rows with specific words with VBA

currently my excel data consists of specific words and #N/A, words are like "build One" "proj ex".. I have prepared a code in which it only deletes one condition but I want it for many words. below is my code. Any help is welcome. Than

Want a specific word from the list from a given string

I want specific word of list from given string, word which is starting with @xxx using php and regular expression. e.g: Volvo Trucks - Rajnikanth - The Epic Split feat. (Live Test 6) @xyz Thalaivar Epic Split Rajanikanth Rajinikanth Rajani Auto Auto

Nginx matches a specific word in the location

I am having trouble matching a specific word in nginx $request_body variable. I want to proxy pass if the body request has a special word in it, So my approach is this: location ~ \.php$ { if ($request_body ~* (.*)) { proxy_pass http://test.proxy; br

Linux: extract a word after a specific word on the same line

I am a new Linux user and I'm self learned, so I'm sorry if this question is stupid. I did search online but couldn't find a proper answer.. How can I extract a word that comes after a specific word in Linux (csh)? More precisely I have a file which

How to color a specific word in the paragraph tag?

I am trying to color a specific word inside a paragraph. Is there a way to make that happen? This is what I am trying to achieve: Say in <p>Hello World</p>, I want to color the word "World" inside the paragraph. Is there a way to do

Display only the values ​​containing specific words in the table

Right now I am working on a search function for my json decoded results The code that I got looks like this: <?php foreach($soeg_decoded as $key => $val){ $value = $val["Value"]; $seotitle = $val["SEOTitle"]; $text = $val["T

Allow only specific words in the URL by htaccess

I searched the entire of stack overflow but was unable to figure out this. I want allow only specific words within URL by htaccess with an exception. E.g: All URLs with none of these words: (big, red, dark) to return 404 error unless there is a & in

href into a specific word of the channel using JavaScript and HTML5

I'm trying to show the content of var fruits (array) in a HTML page using li, ul, a and href for a specific word (not all the text). For example, for the sentence I want a link here I want the link only for the word here but I don't know how to do it

How to highlight a specific word in the WebBrowser C # control

I have a webbrowser control and I am able to get the selected word by the user. I am saving this word in a file and with it I am also saving its byte offset and length. Lets says i have some text in my Web browser control as "Hello Hey Hello" le

I need an elegant way to exclude specific words from the treatment

I am writing an algorithm to extract likely keywords from a document's text. I want to count instances of words and take the top 5 as keywords. Obviously, I want to exclude "insignificant" words lest every document appears with "the" a

About Joyk


Aggregate valuable and interesting links.
Joyk means Joy of geeK