w3hello.com logo
Home PHP C# C++ Android Java Javascript Python IOS SQL HTML videos Categories
remove the lines from RichtextBox?
From your question,it seems that you want to remove the line that contains "MOVE STORAGE".You should try this; var text = "";//Holds the text of current line being looped. var startindex = 0;//The position where selection starts. var endindex = 0;//The length of selection. for (int i = 0; i < richTextBox1.Lines.Length; i++)//Loops through each line of text in RichTextBox { text = richTextBox1.Lines[i];//Stores current line of text. if (text.Contains("MOVE STORAGE") == true)//Checks if the line contains MOVE STORAGE. { startindex = richTextBox1.GetFirstCharIndexFromLine(i);//If match is found the index of first char of that line is stored in startindex. endindex = text.Length;//Gets the

Categories : C#

Richtextbox lines count
Maybe this is too easy, but what about that: private void richTextBox1_TextChanged(object sender, EventArgs e) { var lineCount = richTextBox.Lines.Count(); numberLabel.Text = lineCount.ToString(); } Make sure you assign it to the TextChanged event. If this is not what you need, please add some more information what you are trying to achieve.

Categories : C#

Multiple Lines Webrequest From RichTextBox
This could get you started. Textboxes have a Lines property that contains a collection of strings from each line of the textbox (See this MSDN page for reference) Dim arrUrls() As String = RichTextBox1.Lines For i As Integer = 0 To UBound(arrUrls) If Not arrUrls(i).Length=0 Then Dim request As System.Net.WebRequest = System.Net.WebRequest.Create(arrUrls(i)) Next

Categories : Vb.Net

delete specific lines from richTextBox?
For removing all the lines that start with alter table and contain move storage, you can do this List<string> finalLines = richTextBox1.Lines.ToList(); finalLines.RemoveAll(x => x.StartsWith("ALTER TABLE") && x.Contains("MOVE STORAGE")); richTextBox1.Lines = finalLines.ToArray();

Categories : C#

Remove amount of lines above and below a line containing a string
def remLines(infilepath, outfilepath, delim, above, below): infile = open(infilepath) outfile = open(outfilepath, 'w') buff = [] line = infile.readline() while line: if line.strip() == delim: buff = [] for _ in range(below): # need to error check here, if you're not certain that your input file is correctly formatted infile.readline() else: if len(buff) == above: outfile.write(buff[0]) buff = buff[1:] buff.append(line) line = infile.readline() outfile.write(''.join(buff)) if __name__ == "__main__": remLines('path/to/input', 'path/to/output', "Position fix ind: 0", 6,3) Testing: Input: 1 2 3 *--------------------------------------*

Categories : Python

remove lines which start with *(asterik) in powershell select-string output
You're escaping the wrong character. You do not want to escape ^ as that's your anchor for "starting with". You'll want to escape the asterix, so try this: $result = Get-Content $file.fullName | Select-String $control | select-string -pattern "^*" -notmatch Also, if all you want is the lines, you could also use this: Get-Content $file.fullName | ? { $_ -match $control -and $_ -notmatch '^*'}

Categories : Regex

How do I remove gray/white BackColor of RichTextBox when Disabled?
Windows comes with themes and when you disable a control on a form, the control will show its status according to the current theme. You cannot change how a disabled control looks like, for it will always behave according to the current theme. What you can do, though, is to create a custom control, inherit from RTB and define your Paint-event accordingly. See here for a thread.

Categories : C#

Alphabetize lines in file then remove duplicate lines
As far as the sort goes, I would probably use a natcasesort: natcasesort The rest is pretty trivial and you should be able to implement it as you see fit.

Categories : PHP

How to remove lines (or text in given lines) from file in batch?
If you can get a gnu awk to run in what looks like a Microsoft environment, awk -f hunter.awk file.txt hunter.awk: BEGIN {printing=1;} //* K2START *// { printing=0; next; } //* K2END *// { printing=1; next; } { if ( printing ) print; } May I suggest the GnuWin32 project at http://gnuwin32.sourceforge.net/.

Categories : Batch File

Border.IsMouseOver in RichTextBox ( InlineUIContainer in RichTextBox does not respond to event/trigger )
I had to search the deepest and darkest corners of the internet to find this one, but it looks like there is a hack to enable events for InlineUIElements within a FlowDocument: public class EventEnabledFlowDocument : FlowDocument { protected override bool IsEnabledCore { get { return true; } } } Note that there are likely some nasty side effects from doing this, but it seems to work for my purposes. One side effect I am aware of - event handlers will not be saved if you delete an InlineUIElement and then undo that deletion.

Categories : C#

How to write several RichTextBox Contents into one RTF file preserving font formats of each RichTextBox
You can avoid this problem by merging all the content into the same RichTextBox. Sample: r1.Text = r1.Text + Environment.NewLine; r1.SelectAll(); r1.Copy(); r2.Paste(); r2.SaveFile(path); This approach works fine with StreamWriter as you were using it. On the other hand, why not using a simpler/specifically-designed-for-this-purpose method (SaveFile)? If you don't want to replace the contents in r2, you can just rely on a temporary RichTextBox: r1.Text = r1.Text + Environment.NewLine; r1.SelectAll(); r1.Copy(); RichTextBox temp = new RichTextBox(); temp.Paste(); r2.SelectAll(); r2.Copy(); temp.Paste(); temp.SaveFile(path); NOTE: there might be problems when using StreamWriter (to append, for example). Bear in mind that RTF is a special format which requires a special treat

Categories : C#

PHP script to remove all lines of the file except last n lines
Simply get the number of lines, and use that to know the line numbers for the last two lines: $lines_array = file("./home/userdata/log.ini"); $lines = count($lines_array); $new_output = ""; for ($i=$lines-2; $i<$lines; $i++){ $new_output .= $lines_array[$i]; } file_put_contents("./home/userdata/log.ini");

Categories : PHP

RichTextBox last line save to string in wpf
I know this loop is not the most efficient but that is a copy paste from something similar string lines = tbSend.Text; string lastSting = String.Empty; foreach (string line in lines.Split(' ')) { lastString = line; }

Categories : Wpf

WPF binding List in RichTextBox
Did you check this Repeating databound item in WPF FlowDocument I'm not sure if 'Run' takes a list. You might have to use a itemscontrol or some other control that takes list items

Categories : C#

Take a single line of string from a richTextBox
If I understand correctly, would this work for you? string text = richTextBox.Text.Replace(Environment.NewLine, " "); The alternative could be to use the regex from this answer. string text = Regex.Replace(richTextBox.Text, @" ?| ", " ");

Categories : C#

How do I manipulate the last string of a Richtextbox in Visual Basic
Here's a bit of code to get you in the right direction... There are a couple of variations of .Find, but you probably want to look at the .Select method. With RichTextBox1 .Find("Don") .SelectedText = "Mr. Awesome" End With

Categories : Vb.Net

Find and color all occurences of a String in a RichTextBox
static void Highlight(RichTextBox box, string word , Color color) { int pos =0; string s = box.Text; for (int i = 0; ; ) { int j = s.IndexOf(word , i, StringComparison.CurrentCultureIgnoreCase); if (j < 0) break; box.SelectionStart = j; box.SelectionLength = word .Length; box.SelectionColor = color; i = j + 1; } box.SelectionStart = pos; box.SelectionLength = 0; } Converted Code to VB.net : Public Sub hl(ByVal T As RichTextBox, ByVal Word As String, ByVal color1 As Color) Dim pos As Integer = 0 Dim s As String = T.Text Dim i As Integer = 0 Dim StopWhile As Boolean = False While Not StopWhile Dim j As Integer = s.IndexOf(Word, i) If j < 0 Then StopWhile = True Else

Categories : Vb.Net

How to remove lines from a list which can be found within other longer lines in the list?
Because of the substrings issue, this is going to be pretty difficult. Originally, I was thinking of sorting my list and things like cat and catfish will fall out next to each other, but look at this list:: bug bear calf catbug catbear Sorting this list won't help. Plus, what about this? concatenate cat bear bug Do I leave out cat? It is already in the word concatenate? What about this: cat concatenate bear bug In this case, both the words cat and concatenate are in the list because cat is first in the list before concatenate. Since there's no word that's already part of concatenate, it goes into the list. Unless I need to check both ways. Is the word I want to add to the list in a word that's already in the list and is the word already in the list contained in the word I'm look

Categories : Perl

Remove lines from list
If it is supposed to be empty at the end, empty it after the loop : for server in `cat file1` do ping $server done echo '' > file Otherwise, add -i to sed to edit the source file : for server in `cat file1` do ping $server sed -i '1d' file1 done

Categories : Shell

QByteArray remove first 4 lines
What about searching the fourth occurrence of ' ' (using int QByteArray::indexOf ( char ch, int from = 0 ) const) and then removing the bytes up to that position (using QByteArray & QByteArray::remove ( int pos, int len ))? Edit: Not tested, but something along these lines: QByteArray ba("first second third fourth fifth"); size_t index = 0; unsigned occur = 0; while ((index = ba.indexOf(' ', index)) >= 0){ ++occur; if (occur == 4){ break; } } if (occur == 4){ ba.remove(0, index + 1); }

Categories : C++

Remove surrounding lines in vim
Try following dirty function and check if can help to solve your issue. From cursor position it looks forward and backwards for those strings. Delete them only when both match: function! RemoveSurrondingIfCondition() let s:current_line = line('.') "" Look backwards for the key string. let s:beginif = search( 'v^ifs+falses+thens*$', 'bWn' ) if s:beginif == 0 || s:current_line <= s:beginif return endif "" Set a mark where the _if_ begins execute s:beginif 'mark b' "" Look forward for the end of the _if_ let s:endif = search( 'v^end;s*$', 'Wn' ) if s:endif == 0 || s:endif <= s:beginif || s:current_line >= s:endif return endif "" Delete both end points if searches succeed. execute s:endif . 'delete' 'b delete end

Categories : Vim

Remove lines from CSV file
Try this: $userlist = Import-Csv $file2 | % { $_.Initials } Import-Csv $file1 | ? { $userlist -contains $_.Initials } | Export-Csv $file3 The first line creates an array from the Initials column of the 2nd CSV. With that array you can use the -contains operator for selecting just those records from the 1st CSV that have a matching Initials value.

Categories : Powershell

Powershell csv remove lines
If the files are small-ish and you don't care too much about performance, then the following would be a trivial way: $data = Import-Csv file1 $vips = Import-Csv file2 $data = $data | ?{ $vips -notcontains $_.Initials } $data | Export-Csv file1_new -NoTypeInformation A faster way would be to add the names to remove to a set, but given the things you're talking about here I doubt you'll get into the range of a few thousand or million users.

Categories : Powershell

How to remove blank lines without using tr?
Using sed: sed '/^$/d' inputfile Since you're already piping the output to awk, a better approach would be to replace your command with: vm_ids=$(vim-cmd vmsvc/getallvms | awk 'NF && NR>1 {print $1}' | egrep "[0-9]+")

Categories : Linux

How to remove these horizontal lines in PHPStorm?
You cannot "remove" them -- only hide. Settings (Preferences on Mac) | Editor | Colors & Fonts | General | Method separator color -- either remove any colors assigned or assign the same color as background.

Categories : PHP

Remove lines from file using Hex locations
You should be able to use a clever combination of converting bash numbers from hex to decimal, bash math to add 1 to the decimal offsets, and cut --complement -b to remove the correct segment from the file. EDIT: Like this: $ snip_out 0x0f 0x10 <<< "0123456789abcdeffedcba9876543210" | od -t x1 0000000 30 31 32 33 34 35 36 37 38 39 61 62 63 64 65 65 0000020 64 63 62 61 39 38 37 36 35 34 33 32 31 30 0000036 Where snip_out is a two-parameter shell-script that operates on stdin and stdout: #!/bin/bash START_RANGE_DEC=$(printf "%d" $1) END_RANGE_DEC=$(printf "%d" $2) # Most hex ranges begin with 0; cut begins with 1. CUT_START_DEC=$(( $START_RANGE_DEC + 1 )) CUT_END_DEC=$(( $END_RANGE_DEC + 1 )) # cut likes to append a newline after output. Use head to remove it. exec cut --com

Categories : Linux

remove extra lines from anchors
To remove the spaces below the links, add vertical-align:top; to the .tb-btn-s class. To remove the spaces next to the links, remove the white space in your code. jsFiddle example

Categories : HTML

Bash - remove all lines beginning with 'P'
Explanation use ^ to anchor your pattern to the beginning of the line ; delete lines matching the pattern using sed and the d flag. Solution #1 cat file.txt | sed '/^P/d' Better solution Use sed-only: sed '/^P/d' file.txt > new.txt

Categories : Bash

Remove all the empty lines from a file
You can do this by using preg_replace $filename = "somefile.txt"; $str = file_get_contents($filename); $str = preg_replace("/(^[ ]*|[ ]+)[s ]*[ ]+/", " ", $str); file_put_contents($filename, $str); Note! For displaying the line breaks correctly in notepad, i used " " instead of just " "

Categories : PHP

Regex to remove and preserve lines
Instead of saying: sed -i 's/.*eval(base64_decode("CmVycm.*/<?php/g' say: sed -i 's/eval[(]base64_decode[(]["]CmVycm.*//g' This would preserve the <?php tag and also remove the malicious code from lines where the tag doesn't exist! EDIT: As commented by Birei, you can say: sed -i -e '1 s/.*eval[(]base64_decode[(]["]CmVycm.*/<?php/g' -e '2,$ s/.*eval[(]base64_decode[(]["]CmVycm.*//g'

Categories : PHP

Remove lines with repeated patterns in VIM
Use a global command to capture the first number and if the second number is the same it will match the regex. :g/v(-?d+(.d+)?),s1,/d Or without very magic :g/(-?d+(.d+)?),s1,/d Explanations for the regex. v turns on very magic in vim ( start a regex capture/backreference -? optional minus sign d+ match any number 1 or more times (which get captured by the backreference) (.d+) optional decimal part ) end regex capture , match comma s match some form of whitespace 1 match the same pattern that was captured in the first backreference (in this case the first number) (ie make sure the numbers are the same , make sure the number extends to the next comma :g is short for :global which for every line that matches the regex executes the ex command after it. The command in this case is d

Categories : Regex

How to modify file contents as string whilst having access to methods effecting lines within string?
Use a for-loop, a for-loop over a file object returns one line at a time. #use `with` statement for handling files, it automatically closes the file for you. with open('file.html') as fo, open('file1.html', 'w') as fo1: for line in fo: #reads one line at a time, memory efficient #do something with line, line.strip() fo1.write(line + ' ') #write line to to fo1 If you're trying to modify the same file then use fileinput module: import fileinput for line in fileinput.input('file.html', inplace = True): #do something with line print line #writes the line back to 'file.html' You can also get individual lines from file.read() as well, split it using: fo_as_string = fo.read() lines = fo_as_string.splitlines() But file.read() loads the

Categories : Python

Can we remove the lines of file committed in certain revision?
I don't think this is possible. The whole point of using SVN is to store different versions of a file which you can lookup by revision. That being said, you could use svn cat to get the contents of the file at r100, and again at r102, then manually merge the contents of the outputs to get the intended result.

Categories : Svn

remove lines with first column with 6 digits in a csv files
import csv, tempfile, shutil with open('data.csv', 'rb') as fin, tempfile.NamedTemporaryFile(delete=False) as fout: w = csv.writer(fout) for row in csv.reader(fin): if len(row[0]) <= 4: w.writerow(row) shutil.move(fout.name, 'data.csv')

Categories : Python

How do I randomly remove a certain fraction of a file’s lines?
The rand function produces a real value in the interval [0, 1). If we want a condition that returns true 90% of the time, we can write rand() < 0.9. As you only want to keep 10% of iron atoms: my $percentage = shift @ARGV; while (<>) { print unless this_record_is_iron() && rand() < $percentage; } Then: $ perl reduce_iron.pl 0.9 input-data >reduced-data If we want to delete exactly 90%, then I'd read in the whole file, make an array of indices that point to iron records, shuffle the index list, and delete all but the last 10%: use List::Util qw/shuffle/; my $percentage = shift @ARGV; my(@lines, @iron_idx); while (<>) { push @lines, $_; push @iron_idx, $#lines if this_record_is_iron(); } @iron_idx = (shuffle @iron_idx)[0 .. @iron_idx * $percentage

Categories : Perl

Remove connecting lines in ggplot2 geom_polygon
If you need to plot just borders then you can use geom_path() and column group for group=. You also have to add coord_map() in this case to maintain right aspect ratio between x and y axis. ggplot(ukMapFortSub,aes(long, lat, group=group))+ geom_path(color="black")+coord_map()

Categories : R

Remove a line from list and all successive lines to N?
Since you don't give a clear example of your data, I am not sure of the given solution. If I understand you have document with parts (header) between 'Page' and 'start' That you want to remove. Here a sample of your data with 2 headers: str <- 'Page ...... ### header1 alalalala lalalalalal aalalala lslslsls start ksksksks keep me 1 keep me 2 Page ...... ### header 2 aalalala lslslsls start ksksksks keep me 3 keep me 4' Here I am using readLines to read the document , and find header lines using grep, and remove the join of lines index from the lines list. ll <- readLines(textConnection(str)) ids <- matrix(grep('Page|start',ll),ncol=2,byrow=TRUE) ll[-unlist(apply(ids,1,function(x)seq(x[1],x[2])))] [1] "keep me 1" "keep me 2" "keep me 3" "keep me 4"

Categories : Regex

Using Python to Remove All Lines Matching Regex
You have to read the file try something like: import re inputfile = open('C:\temp\Scripts\remove.txt','w',encoding="utf8") inputfile.write(re.sub("[(.*?)yahoo(.*?) ","",inputfile.read())) file.close() outputfile.close()

Categories : Python

Remove Extra Lines in Excel Sheet Using VB and .cmd
You have these lines towards the end of the Sub: oXL.Quit Handler: oXL.Quit The second Quit call fails, generating the error. You need to exit the procedure just before the Handler (which will only be called in the event of an error): oXL.Quit Exit Sub Handler: oXL.Quit

Categories : Excel

How to remove lines with non word characters using java?
iterate through each character and if ((int(character)>=65 && int(character)<=90) || (int(character)>=97 && int(character) <=122)) continue else { //skip that line }

Categories : Java



© Copyright 2017 w3hello.com Publishing Limited. All rights reserved.