-
-
Notifications
You must be signed in to change notification settings - Fork 3.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add left,right,rpad,lpad string functions - Fix #6079
- With tests :)
- Loading branch information
Showing
6 changed files
with
106 additions
and
0 deletions.
There are no files selected for viewing
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,15 @@ | ||
<h3>left() function</h3> | ||
Returns a substring that contains the <i>n</i> leftmost characters of the string. | ||
|
||
<h4>Syntax</h4> | ||
<code>left(string, pos)</code><br> | ||
|
||
<h4>Arguments</h4> | ||
<code>string</code> - is string. The string. | ||
<br> | ||
<code>length</code> - is int. The numbder of characters from the left to return. | ||
|
||
<h4>Example</h4> | ||
<!-- Show example of function.--> | ||
<code>left('Hello World',5) -> 'Hello'</code><br> | ||
|
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,17 @@ | ||
<h3>lpad() function</h3> | ||
Returns a string with supplied width padded | ||
using the fill character. | ||
|
||
<h4>Syntax</h4> | ||
<code>lpad(string, width, fill)</code><br> | ||
|
||
<h4>Arguments</h4> | ||
<code>string</code> - is string. The string. | ||
<br> | ||
<code>width</code> - is int. The length of the new string. | ||
<br> | ||
<code>fill</code> - is char. The character to padd the remaining space with. | ||
|
||
<h4>Example</h4> | ||
<!-- Show example of function.--> | ||
<code>lpad('Hello', 10, 'x') -> 'Helloxxxxx'</code><br> |
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,15 @@ | ||
<h3>right() function</h3> | ||
Returns a substring that contains the <i>n</i> rightmost characters of the string. | ||
|
||
<h4>Syntax</h4> | ||
<code>right(string, pos)</code><br> | ||
|
||
<h4>Arguments</h4> | ||
<code>string</code> - is string. The string. | ||
<br> | ||
<code>length</code> - is int. The numbder of characters from the right to return. | ||
|
||
<h4>Example</h4> | ||
<!-- Show example of function.--> | ||
<code>right('Hello World',5) -> 'World'</code><br> | ||
|
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,18 @@ | ||
<h3>rpad() function</h3> | ||
Returns a string with supplied width padded | ||
using the fill character. | ||
|
||
<h4>Syntax</h4> | ||
<code>rpad(string, width, fill)</code><br> | ||
|
||
<h4>Arguments</h4> | ||
<code>string</code> - is string. The string. | ||
<br> | ||
<code>width</code> - is int. The length of the new string. | ||
<br> | ||
<code>fill</code> - is char. The character to padd the remaining space with. | ||
|
||
<h4>Example</h4> | ||
<!-- Show example of function.--> | ||
<code>rpad('Hello', 10, 'x') -> 'xxxxxHello'</code><br> | ||
|
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
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