Created
August 5, 2011 08:13
-
-
Save oscarryz/1127110 to your computer and use it in GitHub Desktop.
Este si compila con la versión pública
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//http://www.javamexico.org/foros/java_standard_edition/front_back#comment-15204 | |
sample.FrontBack { | |
main(){ | |
frontBack("abcde","hola").println() | |
} | |
frontBack( a: String, b: String ) : String { | |
ad : Integer = a.length() .+( 1 )./(2) | |
bd : Integer = b.length() .+( 1 )./(2) | |
"%s%s%s%s".%( a.to:(ad), b.to:(bd), a.from:(ad), b.from:(bd) ) | |
} | |
to:( s: String , index : Integer) : String { | |
s.substring( 0, index ) | |
} | |
from:( s : String, index : Integer ) : String { | |
s.substring( index ) | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment