string-copy
This commit is contained in:
parent
e417662c31
commit
db278efcd1
|
@ -108,6 +108,8 @@
|
||||||
'hash-remove!
|
'hash-remove!
|
||||||
'hash-remove
|
'hash-remove
|
||||||
'equal-hash-code
|
'equal-hash-code
|
||||||
|
|
||||||
|
'string-copy
|
||||||
))
|
))
|
||||||
(define-predicate KernelPrimitiveName? KernelPrimitiveName)
|
(define-predicate KernelPrimitiveName? KernelPrimitiveName)
|
||||||
|
|
||||||
|
|
|
@ -791,7 +791,15 @@
|
||||||
if (M.a === 3) {
|
if (M.a === 3) {
|
||||||
end = baselib.numbers.toFixnum(checkNatural(M, 'substring', 2));
|
end = baselib.numbers.toFixnum(checkNatural(M, 'substring', 2));
|
||||||
}
|
}
|
||||||
return str.substring(start, end);
|
return baselib.strings.makeMutableString((str.substring(start, end)).split(""));
|
||||||
|
});
|
||||||
|
|
||||||
|
installPrimitiveProcedure(
|
||||||
|
'string-copy',
|
||||||
|
1,
|
||||||
|
function(M) {
|
||||||
|
var str = checkString(M, 'substring', 0).toString();
|
||||||
|
return baselib.strings.makeMutableString(str.substring(0, str.length).split(""));
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -96,7 +96,7 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
Str.prototype.replace = function (expr, newStr) {
|
Str.prototype.replace = function (expr, newStr) {
|
||||||
return Str.fromString( this.toString().replace(expr, newStr) );
|
return Str.fromString(this.toString().replace(expr, newStr) );
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
@ -117,11 +117,11 @@
|
||||||
};
|
};
|
||||||
|
|
||||||
Str.prototype.toUpperCase = function () {
|
Str.prototype.toUpperCase = function () {
|
||||||
return Str.fromString( this.chars.join("").toUpperCase() );
|
return Str.fromString(this.chars.join("").toUpperCase() );
|
||||||
};
|
};
|
||||||
|
|
||||||
Str.prototype.toLowerCase = function () {
|
Str.prototype.toLowerCase = function () {
|
||||||
return Str.fromString( this.chars.join("").toLowerCase() );
|
return Str.fromString(this.chars.join("").toLowerCase() );
|
||||||
};
|
};
|
||||||
|
|
||||||
Str.prototype.match = function (regexpr) {
|
Str.prototype.match = function (regexpr) {
|
||||||
|
|
|
@ -431,6 +431,7 @@ box?
|
||||||
string-ci<=?
|
string-ci<=?
|
||||||
string-ci>=?
|
string-ci>=?
|
||||||
|
|
||||||
|
string-copy
|
||||||
substring
|
substring
|
||||||
string-append
|
string-append
|
||||||
string->list
|
string->list
|
||||||
|
|
3
tests/more-tests/dots-should-be-syntax-error.rkt
Normal file
3
tests/more-tests/dots-should-be-syntax-error.rkt
Normal file
|
@ -0,0 +1,3 @@
|
||||||
|
#lang planet dyoo/whalesong/cs019
|
||||||
|
|
||||||
|
.. ;; should raise a teaching syntax error
|
|
@ -11,6 +11,7 @@
|
||||||
""
|
""
|
||||||
"l"
|
"l"
|
||||||
"lo"
|
"lo"
|
||||||
|
"hello world"
|
||||||
""
|
""
|
||||||
"hello"
|
"hello"
|
||||||
""
|
""
|
||||||
|
|
|
@ -14,6 +14,8 @@
|
||||||
(substring "hello world" 3 4)
|
(substring "hello world" 3 4)
|
||||||
(substring "hello world" 3 5)
|
(substring "hello world" 3 5)
|
||||||
|
|
||||||
|
(string-copy "hello world")
|
||||||
|
|
||||||
|
|
||||||
(list->string '())
|
(list->string '())
|
||||||
(list->string '(#\h #\e #\l #\l #\o))
|
(list->string '(#\h #\e #\l #\l #\o))
|
||||||
|
|
|
@ -6,4 +6,4 @@
|
||||||
|
|
||||||
(provide version)
|
(provide version)
|
||||||
(: version String)
|
(: version String)
|
||||||
(define version "1.62")
|
(define version "1.64")
|
||||||
|
|
Loading…
Reference in New Issue
Block a user