![]() ![]() ![]() Return a whole number randomly between two given numbers. randomInt( min: NUMBER, max: NUMBER) NUMBER. ![]() Example: random( 1, 5) a random decimal number between 1 and 5.Return a decimal number randomly between two given numbers. random( min: NUMBER, max: NUMBER) NUMBER.Example: random() a random decimal number between 0 and 1.In practice, this comes down to removing the negative sign in front of a number.Ĭheck if a number is positive or negative. max( source1: NUMBER, source2: NUMBER) NUMBER.min( source1: NUMBER, source2: NUMBER) NUMBER.pow( source: NUMBER, exponent: NUMBER) NUMBERĬalculate the result of the first number raised to the power of the second number.Ĭalculate the square root of a number.To learn more, take a look at this Pie example. use the data values inside the JSON string.store a value inside a Pie variable via the Receive trigger.send JSON string to pies via Bridge apps in ProtoPie Connect (e.g., message: “AutomobileSignal”, value: “json string”).Additionally, since most API responses are in JSON format, being able to use parseJson within Pies makes working with APIs much more straightforward. The parseJson function greatly simplifies working with complex data structures in ProtoPie. The latter supports nested key calling and simple references to array-like objects via the. Here, var is the text variable that stores the JSON string, and "key" is the key to parse. Example: parseJson( "", "name") "John"įor example, let's consider parseJson(var, "key").Parses a valid JSON string and returns the corresponding value. parseJson( source: TEXT, key: TEXT) TEXT.Replaces part of a text string with a different text string using regular expressions. regexreplace( source: TEXT, regular expression: TEXT, replacement: TEXT) TEXT.regexextract( source: TEXT, regular expression: TEXT) TEXTĮxtracts the first substrings of a text that match the provided regular expression.Example: rtrim( " helloworld ") " helloworld".Remove whitespace from the right side of a text. Example: ltrim( " helloworld ") "helloworld ".Remove whitespace from the left side of a text. Example: trim( " helloworld ") "helloworld".Remove whitespaces on both sides of a text. Example: replace( "goodbye, John", "goodbye", "thank you") "thank you, John".Example: replace( "helloworld", "world", "protopie") "helloprotopie".Replace a part of a text with another text. replace( source: TEXT, from: TEXT, to: TEXT) TEXT.Example: repeat( "hello", 3) "hellohellohello".Example: repeat( "hello", 2) "hellohello".Repeat a text a specific number of times. repeat( source: TEXT, count: NUMBER) TEXT.Right-pad a text with another text, to a specific length. rpad( source: TEXT, length: NUMBER, pad: TEXT) TEXT.Left-pad a text with another text, to a specific length. lpad( source: TEXT, length: NUMBER, pad: TEXT) TEXT.right( source: TEXT, count: NUMBER) TEXTĮxtract a part of a text from the right side based on a specific number of characters.left( source: TEXT, count: NUMBER) TEXTĮxtract a part of a text from the left side based on a specific number of characters.See use case example.Ĭonvert any text from uppercase to lowercaseĬonvert any text from lowercase to UPPERCASE. Use length for use cases like password validation.See use case example.Ĭount the number of characters in a text. Use indexOf for use cases like email validation.Example: indexOf( "hello world", "goodbye") -1.Example: indexOf( "hello world", "hello") 0.Example: indexOf( "hello world", "world") 6.If the keyword isn't present in the text, the returned value is -1. indexOf( source: TEXT, searchValue: TEXT) NUMBERįind the starting position of a keyword in a text.Example: concat( "hello", "world") "helloworld".concat( source1: TEXT, source2: TEXT) TEXT. ![]()
0 Comments
Leave a Reply. |