string_buffer.cpp (569B)
1 #include "osh.h" 2 3 using namespace osh; 4 5 int main() { 6 StringBuffer sb = "Defining it, as if it was a const char*\n"; 7 8 printp(sb, "Printing some nice text, as if it goes to stdout: ", 1, 2, 3, '\n'); 9 10 sb.format("Some %dnice %s action going on\n", 1, "printf"); 11 println("This is quite nice: ", sb, "really really nice"); 12 13 StringBuffer sub = sb.substr(-10, -6); 14 printp(sub, " - Yes, it support python like indices!\n"); 15 println(sub, "For more things, see `examples/darray.cpp`"); 16 17 return 0; 18 } 19 20 #define OSH_H_IMPLEMENTATION 21 #include "osh.h"