Ref: http://ask.make-money-article.com/que/11122732
import 'dart:async';
import 'dart:io';
import 'dart:convert';
void main() {
readLine().listen(processLine);
}
Stream readLine() => stdin
.transform(UTF8.decoder)
.transform(new LineSplitter());
void processLine(String line) {
print(line);
}
2014年7月13日 星期日
2014年7月12日 星期六
Dart-1
Hello World : Command line
void main() {
print("Hello, World!");
// Ref: http://www.dart-tutorials.co.uk/#Tutorials/Getting-Started
String a = "Hellow World 1";
String b = 'Hello World 2';
var c = "Hello World 3";
print('$a');
print('$b');
print('$c');
String a2 = "1";
String c2 = "1";
int b2 = 1;
print(stringToInt(a2)==b2);
print(a2==b2);
print(a2==c2);
}
int stringToInt(String value) {
return value.codeUnitAt(0)-48;
}
void main() {
print("Hello, World!");
// Ref: http://www.dart-tutorials.co.uk/#Tutorials/Getting-Started
String a = "Hellow World 1";
String b = 'Hello World 2';
var c = "Hello World 3";
print('$a');
print('$b');
print('$c');
String a2 = "1";
String c2 = "1";
int b2 = 1;
print(stringToInt(a2)==b2);
print(a2==b2);
print(a2==c2);
}
int stringToInt(String value) {
return value.codeUnitAt(0)-48;
}
訂閱:
文章 (Atom)