for ES.next.
It could be defined as acting the same way as the following code:
String.prototype.until = function (needle) {
return this.substr(0, this.indexOf(needle));
}
--
Adam Shannon
Web Developer
University of Northern Iowa
Sophomore -- Computer Science B.S. Mathematics
http://ashannon.us
the starting index?
String.prototype.until = function (start, needle) {
return + (this.substr(start, this.indexOf(needle)) || this);
}
(The [ +] part is probably not necessary, but it makes it easier to
see the implementation work in the console.)
Michael A. Smith
Web Developer
True Action
as the following code:
String.prototype.until = function (needle) {
return this.substr(0, this.indexOf(needle));
}
--
Dr. Axel Rauschmayer
a...@rauschma.de
home: rauschma.de
twitter: twitter.com/rauschma
blog: 2ality.com
___
es-discuss mailing list
es
Yes, I see the use for returning the entire string if the needle isn't
found. I was also thinking about a dynamic start position, which is
why I'd favor something like this.
String.prototype.until = function (needle, start) {
start ?? 0;
return this.substr(start, this.indexOf(needle
the beginning until the first encounter with another
substring. This promoted me to write a simple function, called until
and I wondered if it would be something to add with the other string
extras for ES.next.
It could be defined as acting the same way as the following code:
String.prototype.until
string
extras for ES.next.
It could be defined as acting the same way as the following code:
String.prototype.until = function (needle) {
return this.substr(0, this.indexOf(needle));
}
--
Dr. Axel Rauschmayer
a...@rauschma.de
home: rauschma.de
twitter: twitter.com/rauschma
blog
6 matches
Mail list logo