-
Notifications
You must be signed in to change notification settings - Fork 9
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
Showing
9 changed files
with
338 additions
and
18 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 |
---|---|---|
|
@@ -25,8 +25,8 @@ | |
+architect [email protected] | ||
+home https://github.com/objectionary/eo-strings | ||
+package org.eolang.txt | ||
+rt jvm org.eolang:eo-strings:0.2.0 | ||
+version 0.2.0 | ||
+rt jvm org.eolang:eo-strings:0.4.0 | ||
+version 0.4.0 | ||
|
||
# Regular expression in Perl format. | ||
# Free attribute "r" is a string represenation of regex object. | ||
|
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 |
---|---|---|
|
@@ -23,7 +23,7 @@ | |
+architect [email protected] | ||
+home https://github.com/objectionary/eo-strings | ||
+package org.eolang.txt | ||
+rt jvm org.eolang:eo-strings:0.2.0 | ||
+version 0.2.0 | ||
+rt jvm org.eolang:eo-strings:0.4.0 | ||
+version 0.4.0 | ||
|
||
[format args...] > sprintf /string |
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 |
---|---|---|
|
@@ -23,8 +23,8 @@ | |
+architect [email protected] | ||
+home https://github.com/objectionary/eo-strings | ||
+package org.eolang.txt | ||
+rt jvm org.eolang:eo-strings:0.2.0 | ||
+version 0.2.0 | ||
+rt jvm org.eolang:eo-strings:0.4.0 | ||
+version 0.4.0 | ||
|
||
# Reads formatted input from a string. | ||
# This object with two free attributes: | ||
|
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 |
---|---|---|
|
@@ -26,8 +26,8 @@ | |
+architect [email protected] | ||
+home https://github.com/objectionary/eo-strings | ||
+package org.eolang.txt | ||
+rt jvm org.eolang:eo-strings:0.2.0 | ||
+version 0.2.0 | ||
+rt jvm org.eolang:eo-strings:0.4.0 | ||
+version 0.4.0 | ||
|
||
[s] > text | ||
s > @ | ||
|
@@ -36,6 +36,35 @@ | |
text > @ | ||
^.s.slice start len | ||
|
||
# Returns string trimmed from left side | ||
[] > left-trim | ||
left-rec-trim > @ | ||
s | ||
|
||
[str] > left-rec-trim | ||
if. > @ | ||
eq. | ||
length. | ||
str | ||
0 | ||
"" | ||
if. | ||
eq. | ||
slice. | ||
str | ||
0 | ||
1 | ||
" " | ||
left-rec-trim | ||
slice. | ||
str | ||
1 | ||
plus. | ||
length. | ||
str | ||
-1 | ||
str | ||
|
||
# Trim it from both sides | ||
[] > trimmed | ||
rec-trim > @ | ||
|
@@ -100,6 +129,27 @@ | |
(acc.concat x.as-bytes).concat s.as-bytes | ||
res.as-string > @ | ||
|
||
# Returns string repeated n times | ||
[n] > repeated | ||
rec-repeated > @ | ||
s | ||
n | ||
|
||
[str n] > rec-repeated | ||
if. > @ | ||
eq. | ||
n | ||
0 | ||
"" | ||
chained. | ||
text | ||
str | ||
rec-repeated | ||
str | ||
minus. | ||
n | ||
1 | ||
|
||
# Checks that string contains substr | ||
[substr] > contains | ||
substr.length > len! | ||
|
@@ -372,7 +422,7 @@ | |
# Returns an tuple of strings, separated by a given string | ||
[delimiter] > split /tuple | ||
|
||
# Check that all signs in string are letters. | ||
# Check that all signs in string are numbers or letters. | ||
# Works only for english letters | ||
[] > is-alphabetic | ||
reduced. > @ | ||
|
@@ -388,6 +438,49 @@ | |
bytes-1-to-8 | ||
as-bytes. | ||
x | ||
and. > @ | ||
a | ||
int-is-alphabetic | ||
value | ||
|
||
[b] > int-is-alphabetic | ||
or. > @ | ||
and. | ||
gte. | ||
b | ||
48 | ||
lte. | ||
b | ||
57 | ||
and. | ||
gte. | ||
b | ||
97 | ||
lte. | ||
b | ||
122 | ||
|
||
[b] > bytes-1-to-8 | ||
concat. > @ | ||
00-00-00-00-00-00-00 | ||
b | ||
|
||
# Check that all signs in string are letters. | ||
# Works only for english letters | ||
[] > is-alpha | ||
reduced. > @ | ||
list | ||
bytes-as-array | ||
as-bytes. | ||
low-cased. | ||
text | ||
s | ||
TRUE | ||
[a x] | ||
as-int. > value! | ||
is-alphabetic.bytes-1-to-8 | ||
as-bytes. | ||
x | ||
and. > @ | ||
a | ||
int-is-alpha | ||
|
@@ -407,7 +500,35 @@ | |
00-00-00-00-00-00-00 | ||
b | ||
|
||
# Returns concatenaion of all strings | ||
# Check that all signs in string are ASCII characters. | ||
[] > is-ascii | ||
reduced. > @ | ||
list | ||
bytes-as-array | ||
as-bytes. | ||
text | ||
s | ||
TRUE | ||
[a x] | ||
as-int. > value! | ||
is-alphabetic.bytes-1-to-8 | ||
as-bytes. | ||
x | ||
and. > @ | ||
a | ||
int-is-ascii | ||
value | ||
|
||
[b] > int-is-ascii | ||
and. > @ | ||
gte. | ||
b | ||
0 | ||
lte. | ||
b | ||
127 | ||
|
||
# Returns concatenation of all strings | ||
[others...] > chained | ||
text > @ | ||
as-string. | ||
|
Binary file not shown.
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
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
Oops, something went wrong.