Last active
April 7, 2020 06:25
-
-
Save tailorvj/b287f2b94aa5cc7b4e4cd4285a17af38 to your computer and use it in GitHub Desktop.
Dart StringBuffer example
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
main() { | |
StringBuffer sb = new StringBuffer('initial_content'); | |
print('sb.length is ${sb.length}'); | |
print('${sb.toString()}\n'); | |
sb.write("_Hello"); | |
sb.writeAll(['_space', '_and', '_more']); | |
print('sb.length is ${sb.length}'); | |
print('${sb.toString()}\n'); | |
sb.clear(); | |
print('sb.isEmpty? ${sb.isEmpty}\n'); | |
sb.writeAll(['It\'s all', ' fun', ' and', ' games']); | |
print('sb.length is ${sb.length}'); | |
print('${sb.toString()}\n'); | |
sb.clear(); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment