Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
export JAVA_OPTS='-Dfile.encoding=UTF-8'
- Loading branch information
Showing
2 changed files
with
14 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,12 @@ | |||
import scala.io.Source | |||
|
|||
val filename = args(0) | |||
val src = Source.fromFile(filename) // オブジェクトを取得 | |||
var charCount = 0 | |||
var lineCount = 0 | |||
val lines = src.getLines | |||
for (line <- lines) { | |||
charCount += line.length | |||
lineCount += 1 | |||
} | |||
println("文字数 = " + charCount + ", 行数 = " + lineCount) |
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
Original file line number | Original file line | Diff line number | Diff line change |
---|---|---|---|
@@ -0,0 +1,2 @@ | |||
Hello Wolrd | |||
Scala Programming Sample |