Binary Fortress
Binary Fortress Software
CheckCentral
ClipboardFusion
CloudShow
DisplayFusion
FileSeek
HashTools
LogFusion
Notepad Replacer
Online Base64 Decoder
Online Base64 Encoder
Online JSON Formatter
ShellSend
TrayStatus
VoiceBot
WallpaperFusion
Window Inspector
More Apps...
DisplayFusion
CheckCentral
CloudShow
ClipboardFusion
FileSeek
TrayStatus
VoiceBot
WallpaperFusion
Clipboard
Fusion
by Binary Fortress Software
Download
Download
Change Log
Download Beta
Beta Change Log
License (EULA)
Features
Features
HotKeys
Macros
Triggers
Clipboard Syncing
Clipboard Manager
Languages
Free vs Pro
Apps
More
Screenshots
Macros
Languages
Help
Help Guide
FAQ
Discussions
Contact Us
Find My License
Mailing Address
Advanced Settings
Purchase
Login / Register
WARNING: You currently have Javascript disabled!
This website will not function correctly without Javascript enabled.
Title
Message
OK
Confirm
Yes
No
Remove Lines That Don't Contain Specific Text
Return to ClipboardFusion Macros
Description
This macro searches text line by line, and removes any line that doesn't contain "google."
Language
C#.net
Minimum Version
4.2+
Created By
Thomas Malloch (BFS)
Contributors
-
Date Created
Dec 17, 2015
Date Last Modified
Dec 17, 2015
Macro Code
Copy
Select All
using System; using System.Text; public static class ClipboardFusionHelper { public static string ProcessText(string text) { //make sure all of the line breaks are the same //replace CRLF with LF text = text.Replace(Environment.NewLine, "\n"); //replace CR with LF text = text.Replace("\r", "\n"); //create a variable to store the edited text StringBuilder builder = new StringBuilder(); //split the text up by the LF character ('\n') and loop through it foreach(string line in text.Split(new char[]{'\n'}, StringSplitOptions.RemoveEmptyEntries)) { //if the line doesn't have the string "google" in it, ignore the line if(line.IndexOf("google", StringComparison.OrdinalIgnoreCase) == -1) continue; //add the line to the variable builder.AppendLine(line); } //return all of the lines that contain "google" return builder.ToString(); } }