Function to Use String

Dependencies:   mbed

Revision:
0:624614538ca8
Child:
1:906bda113ceb
diff -r 000000000000 -r 624614538ca8 main.cpp
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/main.cpp	Fri Nov 13 08:02:37 2015 +0000
@@ -0,0 +1,42 @@
+#include "mbed.h"
+#include <string>
+//------------------------------------
+// Hyperterminal configuration
+// 9600 bauds, 8-bit data, no parity
+//------------------------------------
+
+Serial pc(SERIAL_TX, SERIAL_RX);
+
+
+int main()
+{
+    //char* txt[]={"Hello\n","World","My Name is Liews"};
+
+    string txt("Hello World My Name is Liews");
+    string str;
+
+    //txt.clear(); //Clear String
+    //int x = txt.empty(); // return 1 if String is Empty
+
+    //pc.printf("size: %d\n",txt.size()); // return size of string
+    //pc.printf("length: %d\n",txt.length());  //return size od string
+
+    //pc.printf("operator[]: %c\n",txt[10]); //access to charecter in string
+    //pc.printf("at: %c\n",txt.at(10));  //access to charecter in string
+
+    //txt += " Tong"; // add string to string
+    //txt.append("s"); // add string to string
+    //txt.push_back('K');// add charecter to string
+
+    //str.assign(txt,15,4); //split string at index first and length
+    //str.assign("Chawanluck Martchan",10); // cut string by length
+    //str.assign("Hello"); // assign string
+    //str.assign(10,'*'); // make string **********
+    
+    
+    
+    
+    
+    pc.printf("string txt: %s\n",txt.c_str());
+    pc.printf("string txt: %s\n",txt.c_str());
+}