Page 41 - Dart Language
P. 41

sb.writeAll(["for ", "efficient ", "string ", "creation "]);
         sb.write("if you are ")
         sb.write("building lots of strings");

         // or you can use method cascades:

         sb
           ..write("Use a StringBuffer")
           ..writeAll(["for ", "efficient ", "string ", "creation "])
           ..write("if you are ")
           ..write("building lots of strings");

         var fullString = sb.toString();

         print(fullString);
         // Use a StringBufferfor efficient string creation if you are building lots of strings

         sb.clear(); // all gone!


        Read Strings online: https://riptutorial.com/dart/topic/5003/strings
































































        https://riptutorial.com/                                                                               36
   36   37   38   39   40   41   42