@@ -180,87 +180,19 @@ class StringInsert(Builtin):
180180 >> StringInsert["noting", "h", 4]
181181 = nothing
182182
183- #> StringInsert["abcdefghijklm", "X", 15]
184- : Cannot insert at position 15 in abcdefghijklm.
185- = StringInsert[abcdefghijklm, X, 15]
186-
187- #> StringInsert[abcdefghijklm, "X", 4]
188- : String or list of strings expected at position 1 in StringInsert[abcdefghijklm, X, 4].
189- = StringInsert[abcdefghijklm, X, 4]
190-
191- #> StringInsert["abcdefghijklm", X, 4]
192- : String expected at position 2 in StringInsert[abcdefghijklm, X, 4].
193- = StringInsert[abcdefghijklm, X, 4]
194-
195- #> StringInsert["abcdefghijklm", "X", a]
196- : Position specification a in StringInsert[abcdefghijklm, X, a] is not a machine-sized integer or a list of machine-sized integers.
197- = StringInsert[abcdefghijklm, X, a]
198-
199- #> StringInsert["abcdefghijklm", "X", 0]
200- : Cannot insert at position 0 in abcdefghijklm.
201- = StringInsert[abcdefghijklm, X, 0]
202-
203183 >> StringInsert["note", "d", -1]
204184 = noted
205185
206186 >> StringInsert["here", "t", -5]
207187 = there
208188
209- #> StringInsert["abcdefghijklm", "X", -15]
210- : Cannot insert at position -15 in abcdefghijklm.
211- = StringInsert[abcdefghijklm, X, -15]
212-
213189 >> StringInsert["adac", "he", {1, 5}]
214190 = headache
215191
216- #> StringInsert["abcdefghijklm", "X", {1, -1, 14, -14}]
217- = XXabcdefghijklmXX
218-
219- #> StringInsert["abcdefghijklm", "X", {1, 0}]
220- : Cannot insert at position 0 in abcdefghijklm.
221- = StringInsert[abcdefghijklm, X, {1, 0}]
222-
223- #> StringInsert["", "X", {1}]
224- = X
225-
226- #> StringInsert["", "X", {1, -1}]
227- = XX
228-
229- #> StringInsert["", "", {1}]
230- = #<--#
231-
232- #> StringInsert["", "X", {1, 2}]
233- : Cannot insert at position 2 in .
234- = StringInsert[, X, {1, 2}]
235-
236- #> StringInsert["abcdefghijklm", "", {1, 2, 3, 4 ,5, -6}]
237- = abcdefghijklm
238-
239- #> StringInsert["abcdefghijklm", "X", {}]
240- = abcdefghijklm
241-
242192 >> StringInsert[{"something", "sometimes"}, " ", 5]
243193 = {some thing, some times}
244194
245- #> StringInsert[{"abcdefghijklm", "Mathics"}, "X", 13]
246- : Cannot insert at position 13 in Mathics.
247- = {abcdefghijklXm, StringInsert[Mathics, X, 13]}
248-
249- #> StringInsert[{"", ""}, "", {1, 1, 1, 1}]
250- = {, }
251-
252- #> StringInsert[{"abcdefghijklm", "Mathics"}, "X", {0, 2}]
253- : Cannot insert at position 0 in abcdefghijklm.
254- : Cannot insert at position 0 in Mathics.
255- = {StringInsert[abcdefghijklm, X, {0, 2}], StringInsert[Mathics, X, {0, 2}]}
256-
257- #> StringInsert[{"abcdefghijklm", Mathics}, "X", {1, 2}]
258- : String or list of strings expected at position 1 in StringInsert[{abcdefghijklm, Mathics}, X, {1, 2}].
259- = StringInsert[{abcdefghijklm, Mathics}, X, {1, 2}]
260-
261- #> StringInsert[{"", "Mathics"}, "X", {1, 1, -1}]
262- = {XXX, XXMathicsX}
263-
195+ Insert dot as millar separators
264196 >> StringInsert["1234567890123456", ".", Range[-16, -4, 3]]
265197 = 1.234.567.890.123.456"""
266198
@@ -468,34 +400,6 @@ class StringPosition(Builtin):
468400 >> StringPosition[data, "uranium"]
469401 = {{299, 305}, {870, 876}, {1538, 1544}, {1671, 1677}, {2300, 2306}, {2784, 2790}, {3093, 3099}}
470402
471- #> StringPosition["123ABCxyABCzzzABCABC", "ABC", -1]
472- : Non-negative integer or Infinity expected at position 3 in StringPosition[123ABCxyABCzzzABCABC, ABC, -1].
473- = StringPosition[123ABCxyABCzzzABCABC, ABC, -1]
474-
475- ## Overlaps
476- #> StringPosition["1231221312112332", RegularExpression["[12]+"]]
477- = {{1, 2}, {2, 2}, {4, 7}, {5, 7}, {6, 7}, {7, 7}, {9, 13}, {10, 13}, {11, 13}, {12, 13}, {13, 13}, {16, 16}}
478- #> StringPosition["1231221312112332", RegularExpression["[12]+"], Overlaps -> False]
479- = {{1, 2}, {4, 7}, {9, 13}, {16, 16}}
480- #> StringPosition["1231221312112332", RegularExpression["[12]+"], Overlaps -> x]
481- = {{1, 2}, {4, 7}, {9, 13}, {16, 16}}
482- #> StringPosition["1231221312112332", RegularExpression["[12]+"], Overlaps -> All]
483- : Overlaps -> All option is not currently implemented in Mathics.
484- = {{1, 2}, {2, 2}, {4, 7}, {5, 7}, {6, 7}, {7, 7}, {9, 13}, {10, 13}, {11, 13}, {12, 13}, {13, 13}, {16, 16}}
485-
486- #> StringPosition["21211121122", {"121", "11"}]
487- = {{2, 4}, {4, 5}, {5, 6}, {6, 8}, {8, 9}}
488- #> StringPosition["21211121122", {"121", "11"}, Overlaps -> False]
489- = {{2, 4}, {5, 6}, {8, 9}}
490-
491- #> StringPosition[{"abc", "abcda"}, "a"]
492- = {{{1, 1}}, {{1, 1}, {5, 5}}}
493-
494- #> StringPosition[{"abc"}, "a", Infinity]
495- = {{{1, 1}}}
496-
497- #> StringPosition["abc"]["123AabcDEabc"]
498- = {{5, 7}, {10, 12}}
499403 """
500404
501405 messages = {
@@ -639,51 +543,6 @@ class StringReplace(_StringFind):
639543 >> StringReplace[{"xyxyxxy", "yxyxyxxxyyxy"}, "xy" -> "A"]
640544 = {AAxA, yAAxxAyA}
641545
642- #> StringReplace["abcabc", "a" -> "b", Infinity]
643- = bbcbbc
644- #> StringReplace[x, "a" -> "b"]
645- : String or list of strings expected at position 1 in StringReplace[x, a -> b].
646- = StringReplace[x, a -> b]
647- #> StringReplace["xyzwxyzwaxyzxyzw", x]
648- : x is not a valid string replacement rule.
649- = StringReplace[xyzwxyzwaxyzxyzw, x]
650- #> StringReplace["xyzwxyzwaxyzxyzw", x -> y]
651- : Element x is not a valid string or pattern element in x.
652- = StringReplace[xyzwxyzwaxyzxyzw, x -> y]
653- #> StringReplace["abcabc", "a" -> "b", -1]
654- : Non-negative integer or Infinity expected at position 3 in StringReplace[abcabc, a -> b, -1].
655- = StringReplace[abcabc, a -> b, -1]
656- #> StringReplace["abc", "b" -> 4]
657- : String expected.
658- = a <> 4 <> c
659-
660- #> StringReplace["01101100010", "01" .. -> "x"]
661- = x1x100x0
662-
663- #> StringReplace["abc abcb abdc", "ab" ~~ _ -> "X"]
664- = X Xb Xc
665-
666- #> StringReplace["abc abcd abcd", WordBoundary ~~ "abc" ~~ WordBoundary -> "XX"]
667- = XX abcd abcd
668-
669- #> StringReplace["abcd acbd", RegularExpression["[ab]"] -> "XX"]
670- = XXXXcd XXcXXd
671-
672- #> StringReplace["abcd acbd", RegularExpression["[ab]"] ~~ _ -> "YY"]
673- = YYcd YYYY
674-
675- #> StringReplace["abcdabcdaabcabcd", {"abc" -> "Y", "d" -> "XXX"}]
676- = YXXXYXXXaYYXXX
677-
678-
679- #> StringReplace[" Have a nice day. ", (StartOfString ~~ Whitespace) | (Whitespace ~~ EndOfString) -> ""] // FullForm
680- = "Have a nice day."
681-
682- #> StringReplace["xyXY", "xy" -> "01"]
683- = 01XY
684- #> StringReplace["xyXY", "xy" -> "01", IgnoreCase -> True]
685- = 0101
686-
687546 StringReplace also can be used as an operator:
688547 >> StringReplace["y" -> "ies"]["city"]
689548 = cities
@@ -764,45 +623,11 @@ class StringRiffle(Builtin):
764623 >> StringRiffle[{"a", "b", "c", "d", "e"}]
765624 = a b c d e
766625
767- #> StringRiffle[{a, b, c, "d", e, "f"}]
768- = a b c d e f
769-
770- ## 1st is not a list
771- #> StringRiffle["abcdef"]
772- : List expected at position 1 in StringRiffle[abcdef].
773- : StringRiffle called with 1 argument; 2 or more arguments are expected.
774- = StringRiffle[abcdef]
775-
776- #> StringRiffle[{"", "", ""}] // FullForm
777- = " "
778-
779- ## This form is not supported
780- #> StringRiffle[{{"a", "b"}, {"c", "d"}}]
781- : Sublist form in position 1 is is not implemented yet.
782- = StringRiffle[{{a, b}, {c, d}}]
783-
784626 >> StringRiffle[{"a", "b", "c", "d", "e"}, ", "]
785627 = a, b, c, d, e
786628
787- #> StringRiffle[{"a", "b", "c", "d", "e"}, sep]
788- : String expected at position 2 in StringRiffle[{a, b, c, d, e}, sep].
789- = StringRiffle[{a, b, c, d, e}, sep]
790-
791629 >> StringRiffle[{"a", "b", "c", "d", "e"}, {"(", " ", ")"}]
792630 = (a b c d e)
793-
794- #> StringRiffle[{"a", "b", "c", "d", "e"}, {" ", ")"}]
795- : String expected at position 2 in StringRiffle[{a, b, c, d, e}, { , )}].
796- = StringRiffle[{a, b, c, d, e}, { , )}]
797- #> StringRiffle[{"a", "b", "c", "d", "e"}, {left, " ", "."}]
798- : String expected at position 2 in StringRiffle[{a, b, c, d, e}, {left, , .}].
799- = StringRiffle[{a, b, c, d, e}, {left, , .}]
800-
801- ## This form is not supported
802- #> StringRiffle[{"a", "b", "c"}, "+", "-"]
803- ## Mathematica result: a+b+c, but we are not support multiple separators
804- : Multiple separators form is not implemented yet.
805- = StringRiffle[{a, b, c}, +, -]
806631 """
807632
808633 attributes = A_PROTECTED | A_READ_PROTECTED
@@ -919,14 +744,6 @@ class StringSplit(Builtin):
919744 >> StringSplit["x", "x"]
920745 = {}
921746
922- #> StringSplit[x]
923- : String or list of strings expected at position 1 in StringSplit[x].
924- = StringSplit[x, Whitespace]
925-
926- #> StringSplit["x", x]
927- : Element x is not a valid string or pattern element in x.
928- = StringSplit[x, x]
929-
930747 Split using a delmiter that has nonzero list of 12's
931748 >> StringSplit["12312123", "12"..]
932749 = {3, 3}
@@ -1043,25 +860,6 @@ class StringTake(Builtin):
1043860 StringTake also supports standard sequence specifications
1044861 >> StringTake["abcdef", All]
1045862 = abcdef
1046-
1047- #> StringTake["abcd", 0] // InputForm
1048- = ""
1049- #> StringTake["abcd", {3, 2}] // InputForm
1050- = ""
1051- #> StringTake["", {1, 0}] // InputForm
1052- = ""
1053-
1054- #> StringTake["abc", {0, 0}]
1055- : Cannot take positions 0 through 0 in "abc".
1056- = StringTake[abc, {0, 0}]
1057-
1058- #> StringTake[{2, 4},2]
1059- : String or list of strings expected at position 1.
1060- = StringTake[{2, 4}, 2]
1061-
1062- #> StringTake["kkkl",Graphics[{}]]
1063- : Integer or a list of sequence specifications expected at position 2.
1064- = StringTake[kkkl, -Graphics-]
1065863 """
1066864
1067865 messages = {
0 commit comments