Use of Mathematical equations between two highlighted amounts.
-
I want to find a difference between the two amounts in my notepad++ after I highlight them.
-
Notepad++, as a text editor, will not do calculations for you, natively.
That said, there are certain plugins that could help – for example, Expression calculator or NppCalc (NppCalc is only available for 32bit Notepad++, so if you have 64-bit, it will not show up in Plugins Admin and won’t work even if installed manually.)
Or you could use one of the scripting plugins (PythonScript is usually the one mentioned here, but LuaScript or others should be able to handle it as well) and write a script that will take the contents of a multi-selection and apply some mathematical operation on them.
-
As a few lines of PythonScript, it could be a simple as:
num1 = int(editor.getTextRange(editor.getSelectionNStart(0), editor.getSelectionNEnd(0)).strip()) num2 = int(editor.getTextRange(editor.getSelectionNStart(1), editor.getSelectionNEnd(1)).strip()) print(num1 - num2)
But of course there are always concerns about error checking (what if there aren’t two selections…what if selected text isn’t numeric…etc) and then also is integer math sufficient, or is floating point wanted…