-
Notifications
You must be signed in to change notification settings - Fork 204
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
4a3e7e6
commit 2ca2376
Showing
4 changed files
with
54 additions
and
7 deletions.
There are no files selected for viewing
Empty file.
This file was deleted.
Oops, something went wrong.
48 changes: 48 additions & 0 deletions
48
showcases/data/Function/Write Functions/String Functions/code.pure
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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; | ||
} |
6 changes: 6 additions & 0 deletions
6
showcases/data/Function/Write Functions/String Functions/info.md
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
--- | ||
title: String function | ||
description: | ||
--- | ||
|
||
Showcases native string legend functions |