From 2ca237681aa37faa68dffb27d880d1a2b9ba42bb Mon Sep 17 00:00:00 2001 From: Mauricio Uyaguari Date: Tue, 30 Jan 2024 19:47:29 -0500 Subject: [PATCH] add string function showcase (#793) --- .../Write Functions/Function/code.pure | 0 .../Function/Write Functions/Function/info.md | 7 --- .../String Functions/code.pure | 48 +++++++++++++++++++ .../Write Functions/String Functions/info.md | 6 +++ 4 files changed, 54 insertions(+), 7 deletions(-) delete mode 100644 showcases/data/Function/Write Functions/Function/code.pure delete mode 100644 showcases/data/Function/Write Functions/Function/info.md create mode 100644 showcases/data/Function/Write Functions/String Functions/code.pure create mode 100644 showcases/data/Function/Write Functions/String Functions/info.md diff --git a/showcases/data/Function/Write Functions/Function/code.pure b/showcases/data/Function/Write Functions/Function/code.pure deleted file mode 100644 index e69de29bb..000000000 diff --git a/showcases/data/Function/Write Functions/Function/info.md b/showcases/data/Function/Write Functions/Function/info.md deleted file mode 100644 index 1efc6edea..000000000 --- a/showcases/data/Function/Write Functions/Function/info.md +++ /dev/null @@ -1,7 +0,0 @@ ---- -title: Function -description: -development: true ---- - -TODO: Some dummy description \ No newline at end of file diff --git a/showcases/data/Function/Write Functions/String Functions/code.pure b/showcases/data/Function/Write Functions/String Functions/code.pure new file mode 100644 index 000000000..53f30d5f4 --- /dev/null +++ b/showcases/data/Function/Write Functions/String Functions/code.pure @@ -0,0 +1,48 @@ +function legend::string::test::testTrim(val: String[1]): String[1] +{ + $val->trim() +} +{ + test1 | testTrim(' A Simple Text To Trim ') => 'A Simple Text To Trim'; + test2 | testTrim(' A Simple Text To Trim') => 'A Simple Text To Trim'; +} + +function legend::string::test::testToUpper(val: String[1]): String[1] +{ + $val->toUpper() +} +{ + test1 | testToUpper('TesT') => 'TEST'; + test2 | testToUpper('TEST') => 'TEST'; +} + +function legend::string::test::testToLower(val: String[1]): String[1] +{ + $val->toLower() +} +{ + test1 | testToLower('TesT') => 'test'; + test2 | testToLower('TEST') => 'test'; +} + +function legend::string::test::testParseInteger(val: String[1]): Integer[1] +{ + $val->parseInteger() +} +{ + test1 | testParseInteger('17') => 17; + test2 | testParseInteger('+00000017') => 17; + test3 | testParseInteger('-17') => -17; + test4 | testParseInteger('9999999999999992') => 9999999999999992; +} + +function legend::string::test::testParseFloat(val: String[1]): Float[1] +{ + $val->parseFloat() +} +{ + test1 | testParseFloat('3.14159') => 3.14159; + test2 | testParseFloat('+0000003.1415900000') => 3.14159; + test3 | testParseFloat('-0000003.1415900000') => -3.14159; + test4 | testParseFloat('0.0') => 0.0; +} diff --git a/showcases/data/Function/Write Functions/String Functions/info.md b/showcases/data/Function/Write Functions/String Functions/info.md new file mode 100644 index 000000000..dafe66bba --- /dev/null +++ b/showcases/data/Function/Write Functions/String Functions/info.md @@ -0,0 +1,6 @@ +--- +title: String function +description: +--- + +Showcases native string legend functions \ No newline at end of file