Helpfile for NppCalc Plugin Author: RinOS https://sourceforge.net/projects/nppcalc/ edited by AE 2019-07-12--Fri--06:45 Instructions: type valid expression in NPP (full list below) two evaluation modes: 1. active calc (ctrl+shift+c) means everytime you press enter, the expression evaluates 2. evaluate selected (alt+enter, personal shortcut assigned) highlight (select), run npp calc plugin command Evaluate Selected or assigned shortcut Test: 2+3 5 2+3, 9*5 ( 5, 45 ) rnd(100) 4 ENTER - calculate Basic + addition - subtraction * multiplication / division ^ power +> concatenation Assignment := assignment += addition assignment -= subtraction assignment *= multiplication assignment /= division assignment Compare = equal to > greater than >= greater than or equal to < less than <= less than or equal to <> not equal to Separator of the integer and the fractional part of the numbers . ( dot ) Separator function ; ( semicolon ) Separator function parameters , ( comma ) String data enclosed in single quotes a := 'abcde' Create array a := ( 1, 2, 3 ) Access to array element a[0] 1 Set value to array element a[0] := 5 a[0] 5 Object in the set '1' IN ( '1', '2', '3' ) True String is an array of characters a := 'abcde' a[0] a Break a string into an array by delimiter a := Split( '1;2;3;4', ';' ) ( '1', '2', '3', '4' ) Join array elements with a glue string Join( ( 1, 2, 3, 'a' ), CRLF ) 1 2 3 a Join( ( 1, 2, 3, 'a' ), CRLF, True ) 1 2 3 'a' Sorting array in ascending Sort( ( 4, 2, 1, 3 ) ) ( 1, 2, 3, 4 ) Sorting array in descending RSort( ( 4, 2, 1, 3 ) ) ( 4, 3, 2, 1 ) Create an array containing a range of elements Range( start, end, step ) Range( 0, 10, 2 ) ( 0, 2, 4, 6, 8, 10 ) Index of the first found element in the array IndexOf( 3, ( 1, 2, 3, 4 ) ) 2 Count elements of the array CountOf( 3, ( 1, 2, 3, 4, 3 ) ) 2 Cast to integer Int( '10.9' ) 10 Cast to float Float( '10.9' ) 10.9 Cast to string Str( 10 ) 10 Cast to boolean Bool( 10.9 ) True Cast to null value Empty( 10.9 ) Add text to the output buffer Echo( 2 ) 2 Select by condition IF ( condition, a, b ) IF ( 1 > 2, echo( true ), echo( false ) ) False IF ( condition, a, b, condition, a, b ) IF ( 1 > 2, echo( true ), echo( false ), 2 > 1, echo( true ), echo( false ) ) False True Loop repeats instruction as long as the condition is met For( i := 0, i < 10, Inc( i ), Echo( i ) ) i := 0; While( i < 10, Inc( i ); Echo( i ) ) i := 0; Repeat( Inc( i ); Echo( i ), i = 10 ) array := ( 1, 2, 3 ); Foreach( elem, array, Echo( elem ) ) Ends execution of the current loop Break Skip the rest of the current loop iteration Continue Evaluates npp code from string Eval( 'MsgBox( 2^8, ''test'' )' ) Evaluates npp code from file ( shared variables ) EvalFromFile( filename ) Logical True False Empty value Null Number pi Pi 3.14159265358979 Base of the natural logarithm e 2.71828182845905 Catalans constant Catalan 0.915965594177 Euler constant Euler 0.577215664902 Golden ratio GoldenRatio 1.61803398875 Speed of light ( m/s ) Light 299792458 Speed of sound ( m/s ) Sound 331.46 Gravitational acceleration ( m/s ) Gravity 9.80665 Carriage return CR Line feed LF Carriage return and Line feed CRLF Hexadecimal number 0xAF 175 Octal number 0t777 511 Binary number 0b100101 37 Character #65 A Increments the value by the relevant value Inc( 5, [1] ) 6 Exponentiation 2^3 8 Squaring Sqr( 20 ) 400 Square root Sqrt( 9 ) 3 Nth root SqrN( 27, 3 ) 3 Integer division 100 div 3 33 Modulo 100 mod 3 1 Percent Per( 200, 10 ) 20 Absolute value Abs( -20 ) 20 Returns e raised to the specified power Exp( 2 ) 7.38905609893065 Natural logarithm Ln( 10 ) 2.30258509299405 Decimal logarithm Lg( 10 ) 1 Binary logarithm Log2( 2 ) 1 Logarithm of the specified base LogN( 5 [base] , 1 ) Factorial of a number Factorial( 5 ) 120 Fibonacci numbers Fibonacci( 10 ) 55 Number of figures in number Digits( 123456 ) 6 A number is even Even( 4 ) True A number is odd Odd( 4 ) False Number is prime IsPrime( 7 ) True Next prime number NextPrime( 7 ) 11 Prev prime number PrevPrime( 11 ) 7 Random prime number RandomPrime( 1000 ) 53 Least common multiple LCM( 27, 18 ) 54 Greatest common divisor GCD( 27, 18 ) 9 Uniform polynomial of one variable Poly( 5, ( 1, 2, 3, 4 ) ) 586 Average array values Avg( ( 1, 2, 3, 4 ) ) 2.5 Sum of values in an array Sum( ( 1, 2, 3, 4 ) ) 10 Sum of squares in an array SumOfSquares( ( 1, 2, 3, 4 ) ) 30 Greatest value in an array Max( ( 1, 2, 3, 4 ) ) 4 Smallest value in an array Min( ( 1, 2, 3, 4 ) ) 1 Standard deviation StdDev( ( 1, 2, 3, 4 ) ) 1.29099444873581 Population standard deviation PopnStdDev( ( 1, 2, 3, 4 ) ) 1.11803398874989 Variance Variance( ( 1, 2, 3, 4 ) ) 1.66666666666667 Population variance PopnVariance( ( 1, 2, 3, 4 ) ) 1.25 Total variance TotalVariance( ( 1, 2, 3, 4 ) ) 5 The Euclidean L2-norm Norm( ( 1, 2, 3, 4 ) ) 5.47722557505166 Sine sin( 0 ) 0 sin(pi/2) 1 sin(pi/4) 0.707106781186547 Sqrt sqrt(2) 1.4142135623731 sqrt(2)/2 0.707106781186548 Arcsine arcsin( 1 ) 1.5707963267949 pi/2 1.5707963267949 Hyperbolic sine SinH( 1 ) 1.1752011936438 Hyperbolic arcsine ArcSinH( 1 ) 0.881373587019543 Cosine cos(0) 1 cos(pi/2) 6.12303176911189E-17 cos(pi/4) 0.707106781186548 Arccosine arccos(1) 0 Hyperbolic cosine cosh( 1 ) 1.54308063481524 Hyperbolic arccosine arccosh(1) 0 Tangent Tan( 1 ) 1.5574077246549 Arctangent ArcTan( 1 ) 0.785398163397448 Arctangent ( Y/X ) ArcTan2( y, x ) 0 Hyperbolic tangent TanH( 1 ) 0.761594155955765 Hyperbolic arctangent ArcTanH( 0 ) 0 Cotangent Cot( 1 ) 0.642092615934331 Arccotangent ArcCot( 1 ) 0.785398163397448 Hyperbolic cotangent CotH( 1 ) 1.31303528549933 Hyperbolic arccotangent ArcCotH( 10 ) 0.100335347731076 Secant Sec( 1 ) 1.85081571768093 Arcsecant ArcSec( 1 ) 0 Hyperbolic secant SecH( 1 ) 0.648054273663885 Hyperbolic arcsecant ArcSecH( 1 ) 0 Cosecant Csc( 1 ) 1.18839510577812 Arccosecant ArcCsc( 1 ) 1.5707963267949 Hyperbolic cosecant CscH( 1 ) 0.850918128239322 Hyperbolic arccosecant ArcCscH( 1 ) 0.549306144334055 Calculates the length of the hypotenuse Hypot( 3, 4 ) 5 Converts radians to degrees RadToDeg( 1 ) 57.2957795130823 Converts radians to grads RadToGrad( 1 ) 63.6619772367581 Converts radians to cycles RadToCycle( 1 ) 0.159154943091895 Converts degrees to radians DegToRad( 1 ) 0.0174532925199433 Converts degrees to grads DegToGrad( 1 ) 1.11111111111111 Converts degrees to cycles DegToCycle( 1 ) 0.00277777777777778 Converts grads to radians GradToRad( 1 ) 0.015707963267949 Converts grads to degrees GradToDeg( 1 ) 0.9 Converts grads to cycles GradToCycle( 1 ) 0.0025 Converts cycles to radians CycleToRad( 1 ) 6.28318530717959 Converts cycles to degrees CycleToDeg( 1 ) 360 Converts cycles to grads CycleToGrad( 1 ) 400 * For trigonometric functions argument in radians Character code Ord( 'A' ) 65 Character Chr( 65 ) A Length string/array Len( 'ABC' ) 3 Index of the first occurrence of a substring within a string Pos( 'bc', 'abcde' ) 2 Index of the first occurrence of a substring within a string, beginning the search at offset PosEx( 'bc', 'abcdebc', 3 ) 6 Getting a substring between two string StrPart( 'ab', 'bc', 'abcdebc' ) cde Compare CompareStr( 'ABC', 'abc' ) False CompareText( 'ABC', 'abc' ) True Change case UpperCase( 'Abc' ) ABC LowerCase( 'Abc' ) abc Remove spaces Trim( ' ABC ' ) ABC TrimLeft( ' ABC' ) ABC TrimRight( 'ABC ' ) ABC Replaces all occurrences of a substring within a string StrReplace( 'abcabc', 'b', 'B' ) aBcaBc Return part of a string SubStr( 'ABCD', 2, 2 ) BC Reversed string StrRev( 'abcd' ) dcba Pad a string from right RightPad( 'abcd', 6, '-' ) abcd-- Pad a string from left LeftPad( 'abcd', 6, '-' ) --abcd Alphabet Alphabet( ' ', ['ru'] ) A B C D E F G H I J K L M N O P Q R S T U V W X Y Z Wraps a string to a given number of characters using a string break character WordWrap( 'string string', 6 ) string string Convert from html to plain text HtmlToPlain( htmldata ) Soundex key of a string Soundex( 'abcd' ) A123 Levenshtein distance between two strings Levenshtein( 'abcd', 'abdc' ) 2 Insert a substring between characters strings Sparse( 'abcdef', '-', 3 ) abc-def Shuffle string characters Shuffle( 'abcdef' ) bdaecf Calculate the entropy of the string Entropy( 'abcdef', [detail = true] ) 2.58496250072116 A unique 128-bit identifier GUID() {7562FA67-9187-4B09-93C2-C7B3D1CBBBFA} Truncates a real number to an integer Trunc( 10.9 ) 10 Fractional part Frac( 10.9 ) 0.9 Rounded to the integer number Round( 10.6 ) 11 Rounded value to a specified power of ten RoundTo( 10.653, -1 ) 10.7 Rounds variables up toward positive infinity Ceil( 10.5 ) 11 Rounds variables toward negative infinity Floor( 10.5 ) 10 Hexadecimal number Hex( 1000 ) 0x3E8 Octal number Oct( 100 ) 0t144 Binary number Bin( 20 ) 0b10100 Roman numeral Roman( 15 ) XV RomanToDec( 'XVIII' ) 18 Format FormatFloat( '0.00', 1.2345 ) 1.23 Bytes( 102434435 ) 97.69 MB Convert to any number system ( from 2 to 36 ) DecToBase( 200, 16 ) C8 BaseToDec( 'C8', 16 ) 200 Current date Date( ['d', 'M', 'y'] ) 12/07/2019 Date( 'd' ) 12 Current time Time( ['h', 'm', 's'] ) 06:57:50 Time( 's' ) 51 Current date and time Now( ['d', 'M', 'y', 'h', 'm', 's'] ) 12/07/2019 06:57:53 Now( 'y' ) 2019 Retrieves the number of milliseconds that have elapsed since the system was started GetTickCount() 2454489421 Date shifted by a specified number IncSecond( date(), 30 ) 12/07/2019 00:00:30 IncMinute( date(), 30 ) 12/07/2019 00:30:00 IncHour( date(), 12 ) 12/07/2019 12:00:00 IncDay( date(), 7 ) 19/07/2019 IncWeek( date(), 1 ) 19/07/2019 IncMonth( date(), 12 ) 12/07/2020 IncYear( date(), 10 ) 12/07/2029 *Second parameter defaults to 1 **If the parameter is negative then there is a decrease Part of the value of a date SecondOf( now() ) 50 MinuteOf( now() ) 58 HourOf( now() ) 6 DayOf( now() ) 12 WeekOf( now() ) 28 MonthOf( now() ) 7 YearOf( now() ) 2019 Difference between dates SecondsBetween( date(), date() + 1 ) 86400 MinutesBetween( date(), date() + 1 ) 1440 HoursBetween( date(), date() + 1 ) 24 DaysBetween( date(), date() + 1 ) 1 WeeksBetween( date(), date() + 7 ) 1 MonthsBetween( date(), date() + 31 ) 1 YearsBetween( date(), date() + 366 ) 1 DateBetween( date(), date() + 1.11, ['ru'] ) 1 day 2 hours 38 minutes 23 seconds Weeks in year WeeksInYear( now() ) Days in year DaysInYear( now() ) Days in month DaysInMonth( now() ) Index number for the date/time MonthOfTheYear( now() ) 7 WeekOfTheYear( now() ) 28 DayOfTheYear( now() ) 193 HourOfTheYear( now() ) 4614 MinuteOfTheYear( now() ) 276899 SecondOfTheYear( now() ) 16613972 MilliSecondOfTheYear( now() ) 3729071112 WeekOfTheMonth( now() ) 2 DayOfTheMonth( now() ) 12 HourOfTheMonth( now() ) 270 MinuteOfTheMonth( now() ) 16259 SecondOfTheMonth( now() ) 975594 MilliSecondOfTheMonth( now() ) 975595000 DayOfTheWeek( now() ) 5 HourOfTheWeek( now() ) 102 MinuteOfTheWeek( now() ) 6180 SecondOfTheWeek( now() ) 370801 MilliSecondOfTheWeek( now() ) 370802000 HourOfTheDay( now() ) 7 MinuteOfTheDay( now() ) 420 SecondOfTheDay( now() ) MilliSecondOfTheDay( now() ) MinuteOfTheHour( now() ) SecondOfTheHour( now() ) MilliSecondOfTheHour( now() ) SecondOfTheMinute( now() ) MilliSecondOfTheMinute( now() ) MilliSecondOfTheSecond( now() ) Compare date SameDateTime( date(), time() ) SameDate( date(), date() ) SameTime( now(), time() ) Is leap year IsLeapYear( 2012 ) Age of the person by date Age( '01.01.1965', [now()] ) Horoscope Horoscope( '01.01.1965', ['ru'] ) Formatting dates UnixTime( Now() ) @1562914822 TimeUnix( '@1111111111' ) 18/03/2005 01:58:31 FormatDateTime( 'dd.MM.yyyy hh:mm:ss', now() ) 12.07.2019 07:00:49 FormatDateTime( 'ddd dd.MM.yyyy hh:mm:ss', now() ) Fri 12.07.2019 07:01:35 FormatDateTime( 'dddd dd.MM.yyyy hh:mm:ss', now() ) Friday 12.07.2019 07:02:22 FormatDateTime( 'dddd mmm dd, yyyy -- hh:mm:ss', now() ) Friday Jul 12, 2019 -- 07:02:38 FormatDateTime( 'yyyy-mm-dd', now() ) 2019-07-12 // the following is TimeStamp macro in my version (using Alt+F5) LATER: get it to delete the code FormatDateTime( 'yyyy-mm-dd---ddd---hh:mm', now() ) 2019-07-12---Fri---07:22 The distance between the geographic coordinates in meters VincentyDistance( latitude1, longitude1, latitude2, longitude2 ) 0 VincentyDistance( 55.7537, 37.6199, 40.7145, -74.0071 ) 7526639.089 Euclidean distance EuclideanDistance( (100, 100), (200, 200) ) 141.42135623731 Check bits isBitSet( 500, 3 ) False Enable bit BitOn( 500, 3 ) 508 Disable bit BitOff( 508, 3 ) 500 Invert bit BitToggle( 500, 3 ) 508 Bitwise "AND" 10 and 50 2 Bitwise "OR" 10 or 50 58 Bitwise "XOR" 10 xor 50 56 Bitwise shift left 10 shl 1 20 Bitwise shift right 10 shr 1 5 Negative not True False Random number generator Rnd( 100 ) 22 Random string generator RndP( 12, ['char map'] ) RAVHDA6QgGt6 Random numbers with Gaussian distribution about the mean RandG( mean, stddev ) 0 Random number from a given range RandomRange( 10, 100 ) 45 Random picked from the array RandomFrom( ( 1, 2, 3, 4 ) ) 3 Beep Beep( freq, duration_ms ) Beep ( 440, 550 ) Plays a sound PlaySound( filename, false [async] ) Wait n milliseconds ( break ctrl-break ) Wait( 5000 ) Dialog box with a message MsgBox( 'message', 'caption' ) Start program Exec( 'filename', ['parameters'], ['directory'] ) Open com-port handle := OpenComPort( 1 ) Set baud rate BaudRate( handle, 9600 ) Connect to a TCP/IP handle := TcpClient( 'host / ip', port, [Timeout=1000] ) Write data WriteData( handle, 'data' ) Read data ReadData( handle, count ) Read all data ReadAll( handle ) Close connection Close( handle ) Sending messages users registered in the working group NetSend( 'host / ip', 'message' ) Checking the connections TCP/IP Ping( 'host / ip' ) Ping(www.google.com) time: 78 ms Function names correspond to encoding algorithm. _E - encoding, _D - decoding Base64_E( 'string' ) Base64_D( 'c3RyaW5n' ) Morse_E( 'string', 'eng' ['rus'] ) Morse_D( '... - .-. .. -. --.', 'eng' ['rus'] ) UUE_E( 'string' ) UUE_D( '&