Skip to content

Instantly share code, notes, and snippets.

@oscarryz
Created August 5, 2011 08:13
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save oscarryz/1127110 to your computer and use it in GitHub Desktop.
Save oscarryz/1127110 to your computer and use it in GitHub Desktop.
Este si compila con la versión pública
//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