scratch – Diff between revs 75 and 125
?pathlinks?
Rev 75 | Rev 125 | |||
---|---|---|---|---|
Line 132... | Line 132... | |||
132 | replaceAll: (str, replacement, limit = 0) -> |
132 | replaceAll: (str, replacement, limit = 0) -> |
|
133 | @regex.lastIndex = 0 |
133 | @regex.lastIndex = 0 |
|
134 | count = 0 |
134 | count = 0 |
|
135 | while @regex.test(str) and (limit is 0 or count < limit) |
135 | while @regex.test(str) and (limit is 0 or count < limit) |
|
136 | @regex.lastIndex = 0 |
136 | @regex.lastIndex = 0 |
|
137 | str = str.replace @regex, '' |
137 | str = str.replace @regex, replacement |
|
138 | count++ |
138 | count++ |
|
Line 139... | Line 139... | |||
139 | |
139 | |