Numeric and Text Processor

This usefull set of methods you can use with calc api request.

For example: %Result=/get https://api.pipe.bot/calc round(%sum,2)

rand(min,max)

Generate a random integer. If called without the optional min, max arguments rand() returns a pseudo-random integer between 0 and getrandmax(). If you want a random number between 5 and 15 (inclusive).

For example: rand(5, 15)

round(val,precision)

Returns the rounded value of val to specified precision (number of digits after the decimal point). Precision can also be negative or zero (default).

Example: round(12.25, 1)

str_replace(search,replace,subject,[count])

This function returns a string or an array with all occurrences of search in subject replaced with the given replace value. Count — If passed, this will be set to the number of replacements performed.

For example: str_replace('no','yes','I always say no')

mb_strlen('%String')

Get string length

mb_convert_case('%String',mode)

Performs case folding on a %String, converted in the way specified by mode.

Mode — The mode of the conversion. It can be one of:

  • 0 — Upper case
  • 1 — Lower case
  • 2 — Camel case

mb_strpos('%String','%Search')

Find position of last occurrence of a search string in a string. This can be useful, when you need to check, is string contains some keywords. If result is '0', keyword not contains in provided string

Example: mb_strrpos('Where i can buy tickets?','ticket')