Refactor
:my
=>
'code'
Codes
Refactorings
Popular
Best
Submit
Spam
Account
Logout
Login
JavaScript doesn't seem to be activated, expect things to be ugly and sloppy!
More Jobs
Recent
Cheap ruby block templating
Bindings on caller
Initial script execution very slow and skewing results
suppress ERB newlines
Keeping the database clean
Arrays, loops, strings...
Similar virtual attributes and their getters/setter
Check type is XML Serializable
Serena Collage slideshow
Shortest regular expression for matching a subdomain.
Popular
Caching Methods
How to find max, min of three numbers?
Similar virtual attributes and their getters/setter
Shortest regular expression for matching a subdomain.
Arrays, loops, strings...
Cheap ruby block templating
Check type is XML Serializable
Bindings on caller
Apache log file sorting
Tab-Switching in jQuery
Pastable version of
Get the Filename segment of a URI
<div style="overflow:auto;border:solid 1px #ccc;background:#000;color:#F8F8F8"> <div class="section"> <span style="margin:0;padding:4px 6px;font-size:12px;float:right;">The original Ruby code.</span> <pre style="float:left;margin:0 10px;border-right:0;color:#666;">1 2 3 4</pre> <pre class="sunburst"><span style="color:#E28964;">def</span> <span style="color:#89BDFF;">filename</span> <span style="color:#3E87E3;">self</span>.<span style="color:#89BDFF;">uri</span>.<span style="color:#89BDFF;">split</span>(<span style="color:#65B042;"><span style="color:#65B042;">'</span>/<span style="color:#65B042;">'</span></span>).<span style="color:#89BDFF;">last</span> <span style="color:#E28964;">end</span> </pre> </div> </div> <div style="overflow:auto;border:solid 1px #ccc;background:#000;color:#F8F8F8"> <div class="section"> <span style="margin:0;padding:4px 6px;font-size:12px;float:right;">The original C# code.</span> <pre style="float:left;margin:0 10px;border-right:0;color:#666;">1 2 3 4 5 6 7 8 9</pre> <pre class="sunburst"><span style="color:#E28964;">public</span> <span style="color:#99CF50;">string</span> FileName { get { <span style="color:#99CF50;">char</span>[] delim = { <span style="color:#65B042;"><span style="color:#65B042;">'</span>/<span style="color:#65B042;">'</span></span> }; <span style="color:#99CF50;">string</span>[] a = <span style="color:#E28964;">this</span>.Uri.Split(delim); <span style="color:#E28964;">return</span> a[a.Length - <span style="color:#3387CC;">1</span>]; } } </pre> </div> </div> <a href="http://refactormycode.com/codes/200-get-the-filename-segment-of-a-uri" style="color:#fff" title="As seen on RefactorMyCode.com"><img alt="Small_logo" src="http://refactormycode.com/images/small_logo.gif" style="border:0" /></a>