* rename replaceTrailingBraces to replaceTrailingBrackets

This commit is contained in:
Reinhard Pointner 2011-11-08 04:34:24 +00:00
parent 0791b35800
commit 310d2fc6a6
2 changed files with 4 additions and 3 deletions

View File

@ -87,7 +87,8 @@ String.metaClass.after = {
*
* e.g. "The IT Crowd (UK)" -> "The IT Crowd"
*/
String.metaClass.replaceTrailingBraces = { replacement = "" -> replaceAll(/\s*[(]([^)]*)[)]$/, replacement) }
String.metaClass.replaceTrailingBraces =
String.metaClass.replaceTrailingBrackets = { replacement = "" -> replaceAll(/\s*[(]([^)]*)[)]$/, replacement) }
/**

View File

@ -101,7 +101,7 @@
<code>E:/Complete/<span class="block start">{</span><span class="variable">n</span><span class="block end">}</span> (<span class="block start">{</span><span class="variable">y</span><span class="block end">}</span>)<span class="block start">{</span><span class="string">'/Season '</span>+<span class="variable">s</span><span class="block end">}</span>/<span class="block start">{</span><span class="variable">s</span>+<span class="string">'x'</span><span class="block end">}</span><span class="block start">{</span><span class="variable">e</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span> - <span class="block start">{</span><span class="variable">t</span><span class="block end">}</span></code>Rename and <strong>move</strong> files. The directory structure is completely up to you.
</p>
<p>
<code><span class="block start">{</span><span class="variable">n</span>.<span class="method">replaceTrailingBraces</span>()<span class="block end">}</span> - <span class="block start">{</span><span class="variable">s</span>+<span class="string">'x'</span><span class="block end">}</span><span class="block start">{</span><span class="variable">e</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span> - <span class="block start">{</span><span class="variable">t</span>.<span class="method">replaceAll</span>(<span class="regex">/[!?.]+$/</span>).<span class="method">replaceAll</span>(<span class="regex">/[`´]/</span>, <span class="string">"'"</span>).<span class="method">lowerTrail</span>().<span class="method">replacePart</span>(<span class="string">', Part $1'</span>)<span class="block end">}</span></code>My personal favorite. Pretty much 1x01, but with lots of cleanup operations.
<code><span class="block start">{</span><span class="variable">n</span>.<span class="method">replaceTrailingBrackets</span>()<span class="block end">}</span> - <span class="block start">{</span><span class="variable">s</span>+<span class="string">'x'</span><span class="block end">}</span><span class="block start">{</span><span class="variable">e</span>.<span class="method">pad</span>(<span class="numeral">2</span>)<span class="block end">}</span> - <span class="block start">{</span><span class="variable">t</span>.<span class="method">replaceAll</span>(<span class="regex">/[!?.]+$/</span>).<span class="method">replaceAll</span>(<span class="regex">/[`´]/</span>, <span class="string">"'"</span>).<span class="method">lowerTrail</span>().<span class="method">replacePart</span>(<span class="string">', Part $1'</span>)<span class="block end">}</span></code>My personal favorite. Pretty much 1x01, but with lots of cleanup operations.
</p>
<h2 class="reference" id="bindings">
@ -295,7 +295,7 @@
<code><span class="method">after</span>(<span class="regex">pattern</span>)</code>Get the substring after the given pattern or the original value.
</p>
<p>
<code><span class="method">replaceTrailingBraces</span>(<span class="string">replacement</span> = <span class="string">""</span>)</code>Replace trailing parenthesis including any leading whitespace (e.g. "The IT Crowd (UK)" -> "The IT Crowd").
<code><span class="method">replaceTrailingBrackets</span>(<span class="string">replacement</span> = <span class="string">""</span>)</code>Replace trailing parenthesis including any leading whitespace (e.g. "The IT Crowd (UK)" -> "The IT Crowd").
</p>
<p>
<code><span class="method">replacePart</span>(<span class="string">replacement</span> = <span class="string">""</span>)</code>Replace part identifier (e.g. "Today Is the Day (1)" -> "Today Is the Day, Part 1").