Skip to content

Instantly share code, notes, and snippets.

@msulima
Created July 6, 2013 15:03
Show Gist options
  • Select an option

  • Save msulima/5940152 to your computer and use it in GitHub Desktop.

Select an option

Save msulima/5940152 to your computer and use it in GitHub Desktop.
package com.futureprocessing.scala_sugar
object StringsScalaLikeJava {
def padStart(string: String, minLength: Int, padChar: Char): String = {
if (string.length >= minLength) {
return string
}
val sb: StringBuilder = new StringBuilder(minLength)
for (i <- string.length until minLength) {
sb.append(padChar)
}
sb.append(string)
return sb.toString()
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment