I haven't read Object Oriented JavaScript so I am unfamiliar with the exact rules of this exercise, however I suspect the RegExp Object is what you need.
https://developer.mozilla.org/en/JavaScript/Reference/Global_Objects/RegExp The RegEx object is one of the global objects like String. It operates on strings but is not a method of String and therefore should be fair game. Let me know if this works for you and if you need further hints. On Sat, May 7, 2011 at 10:20 AM, radiate <[email protected]> wrote: > At this point, I'm not terribly worried about it being cross-browser > compatible - this is stricly a lesson in syntax. I am using the > string as an array but I don't have a good algorithim to handle it. I > know you would have to account for a few different scenarios: > > 1) any characters before the first occurrence > 2) any characters after the first occurrence and in between the next > occurrence > 3) any characters after the last occurrence. > > I thought I would do this by first looping through the string and > creating an array that would capture every position that the substring > occurred. I would then loop through the array and invoke a function > that would take the current position that I'm in in that string and > loop until I reached the next occurrence of the substring. And so on > and so forth. > > This seems too needlessly complex and I'm sure there is a much easier > way to handle this function. > > > > On May 7, 7:05 am, Balázs Galambosi <[email protected]> wrote: >> On Sat, May 7, 2011 at 12:56 PM, Jose Antonio Perez <[email protected]> >> wrote: >> >> >> >> >> This isn't part of the spec, and isn't cross-browser. >> >> > Specified in ES5:http://es5.github.com/#x15.5.5.2 >> >> Thanks, I wasn't sure if this was included in ES5. >> >> - Balázs > > -- > To view archived discussions from the original JSMentors Mailman list: > http://www.mail-archive.com/[email protected]/ > > To search via a non-Google archive, visit here: > http://www.mail-archive.com/[email protected]/ > > To unsubscribe from this group, send email to > [email protected] > -- To view archived discussions from the original JSMentors Mailman list: http://www.mail-archive.com/[email protected]/ To search via a non-Google archive, visit here: http://www.mail-archive.com/[email protected]/ To unsubscribe from this group, send email to [email protected]
