SigServer:SignatureMath: Difference between revisions

Jump to navigation Jump to search
→‎Function Reference: Un-bolded "Example" for easier reading
(→‎Function Reference: Un-bolded "Example" for easier reading)
Line 96: Line 96:
Returns the absolute value of a number
Returns the absolute value of a number


'''Example'''
Example:
  abs(1);  // Returns 1
  abs(1);  // Returns 1
  abs(-1); // Returns 1
  abs(-1); // Returns 1
Line 104: Line 104:
Returns the ceiling of a number.
Returns the ceiling of a number.


'''Example'''
Example:
  ceil(1.4); // Returns 2
  ceil(1.4); // Returns 2
  ceil(1.9); // Returns 2
  ceil(1.9); // Returns 2
Line 112: Line 112:
Returns the floor of a number.
Returns the floor of a number.


'''Example'''
Example:
  floor(1.1); // Returns 1
  floor(1.1); // Returns 1
  floor(1.9); // Returns 1
  floor(1.9); // Returns 1
Line 120: Line 120:
Returns the numerically highest value of the given arguments. At least two arguments are required.
Returns the numerically highest value of the given arguments. At least two arguments are required.


'''Example'''
Example:
  max(3, 5);          // Returns 5
  max(3, 5);          // Returns 5
  max(3, 1.2, 5, 5.1); // Returns 5.1
  max(3, 1.2, 5, 5.1); // Returns 5.1


==== min ====
==== min ====
Line 129: Line 128:
Returns the numerically lowest value of the given arguments. At least two arguments are required.
Returns the numerically lowest value of the given arguments. At least two arguments are required.


'''Example'''
Example:
  min(3, 5);          // Returns 3
  min(3, 5);          // Returns 3
  min(3, 1.2, 5, 5.1); // Returns 1.2
  min(3, 1.2, 5, 5.1); // Returns 1.2
Line 137: Line 136:
Returns the reminder when dividing dividend with divider.
Returns the reminder when dividing dividend with divider.


'''Example'''
Example:
  mod(10, 3); // Returns 1
  mod(10, 3); // Returns 1


Line 144: Line 143:
Returns base to the power of exp.
Returns base to the power of exp.


'''Example'''
Example:
  pow(3, 2); // Returns 9
  pow(3, 2); // Returns 9
  pow(2, 3); // Returns 8
  pow(2, 3); // Returns 8
Line 152: Line 151:
Returns a rounded number with the given precision. If precision isn't specified it will return an integer.
Returns a rounded number with the given precision. If precision isn't specified it will return an integer.


'''Example'''
Example:
  round(2.4);    // Returns 2
  round(2.4);    // Returns 2
  round(2.5);    // Returns 3
  round(2.5);    // Returns 3
Line 161: Line 160:
Returns the square root of value.
Returns the square root of value.


'''Example'''
Example:
  sqrt(9); // Returns 3
  sqrt(9); // Returns 3


Line 176: Line 175:
If only first argument is specified it converts all the characters to lowercase. The second argument may be "first" or "words". If it is "first" only the string's first character will be converted. If it is set to "words", every word's first character will be converted.
If only first argument is specified it converts all the characters to lowercase. The second argument may be "first" or "words". If it is "first" only the string's first character will be converted. If it is set to "words", every word's first character will be converted.


'''Example'''
Example:
  lowercase("Foo Bar");          // Returns "foo bar"
  lowercase("Foo Bar");          // Returns "foo bar"
  lowercase("Foo Bar", "first"); // Returns "foo Bar"
  lowercase("Foo Bar", "first"); // Returns "foo Bar"
Line 185: Line 184:
Check's if the first argument is not empty. Returns TRUE or FALSE if the optional arguments aren't specified. If they are specified it returns the second argument if TRUE and the third argument if FALSE.
Check's if the first argument is not empty. Returns TRUE or FALSE if the optional arguments aren't specified. If they are specified it returns the second argument if TRUE and the third argument if FALSE.


'''Example'''
Example:
  notempty("");                      // Returns false
  notempty("");                      // Returns false
  notempty("Foobar");                // Returns true
  notempty("Foobar");                // Returns true
Line 195: Line 194:
Takes value and adds padding on left side if third argument isn't specified. Third argument is optional and may be "left" or "right" and specifies the padding alignment. Second argument specifies the padding width.
Takes value and adds padding on left side if third argument isn't specified. Third argument is optional and may be "left" or "right" and specifies the padding alignment. Second argument specifies the padding width.


'''Example'''
Example:
  padding("2.40", 6);        // Returns "  2.40"
  padding("2.40", 6);        // Returns "  2.40"
  padding("12.40", 6);        // Returns " 12.40"
  padding("12.40", 6);        // Returns " 12.40"
Line 205: Line 204:
Returns date and time according to the first argument. The format syntax is the same as PHP's date(). The optional argument may be a timestamp or string with date.
Returns date and time according to the first argument. The format syntax is the same as PHP's date(). The optional argument may be a timestamp or string with date.


'''Example'''
Example:
  date("Y-m-d");                        // Returns current date e.g. "2007-11-20"
  date("Y-m-d");                        // Returns current date e.g. "2007-11-20"
  date("H:i:s");                        // Returns current time, e.g. "19:50:37"
  date("H:i:s");                        // Returns current time, e.g. "19:50:37"
Line 214: Line 213:
Returns string containing value with a fixed number of decimals.
Returns string containing value with a fixed number of decimals.


'''Example'''
Example:
  precision(5, 2);    // Returns "5.00"
  precision(5, 2);    // Returns "5.00"
  precision(5.25, 1); // Returns "5.2"
  precision(5.25, 1); // Returns "5.2"
Line 224: Line 223:
Returns the string truncated to specified length. If third argument is specified it will be appended to the returned string if it's truncated.
Returns the string truncated to specified length. If third argument is specified it will be appended to the returned string if it's truncated.


'''Example'''
Example:
  truncate("Foobar", 3);      // Returns "Foo"
  truncate("Foobar", 3);      // Returns "Foo"
  truncate("Foobar", 4, ".."); // Returns "Fo.."
  truncate("Foobar", 4, ".."); // Returns "Fo.."
Line 236: Line 235:
If only first argument is specified it converts all the characters to uppercase. The second argument may be "first" or "words". If it is "first" only the string's first character will be converted. If it is set to "words", every word's first character will be converted.
If only first argument is specified it converts all the characters to uppercase. The second argument may be "first" or "words". If it is "first" only the string's first character will be converted. If it is set to "words", every word's first character will be converted.


'''Example'''
Example:
  uppercase("Foo Bar");          // Returns "FOO BAR"
  uppercase("Foo Bar");          // Returns "FOO BAR"
  uppercase("foo bar", "first"); // Returns "Foo bar"
  uppercase("foo bar", "first"); // Returns "Foo bar"
128

edits

Navigation menu

MediaWiki spam blocked by CleanTalk.
MediaWiki spam blocked by CleanTalk.