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
Sum All Values
Return to ClipboardFusion Macros
Description
Takes a list of values separated by line endings and sums all the values if it can. A message box will be shown with the summed value. If not all values are numeric, you will receive an additional warning, but the numeric values will still be summed. The summed value is then placed in the clipboard.
Language
C#.net
Minimum Version
3.3+
Created By
wooster11
Contributors
-
Date Created
Aug 19, 2014
Date Last Modified
Aug 19, 2014
Macro Code
Copy
Select All
using System; using System.IO; using System.Windows.Forms; public static class ClipboardFusionHelper { public static string ProcessText(string text) { StringReader sr = new StringReader(text); bool notAllValuesAreNumeric = false; double summedValues = 0.0; string lineStringVal; lineStringVal= sr.ReadLine(); while (lineStringVal != null) { double val; if (Double.TryParse(lineStringVal, out val)) summedValues += val; else notAllValuesAreNumeric = true; lineStringVal = sr.ReadLine(); } string message = "Sum: " + summedValues.ToString(); if (notAllValuesAreNumeric) message += "\n!!!NOTE: Not All Values were numeric.!!!"; MessageBox.Show(message, "Sum of All Lines", MessageBoxButtons.OK, MessageBoxIcon.Information); return summedValues.ToString(); } }