Donnerwolf1203
2/10/2020 - 8:48 AM

C++ Strings

#include <iostream>

int main() {
  //initialize a string
  std::string txt;
  //declare a string
  txt = "Test1";
  //appends a string to a string;
  txt = txt.append("Test2");
  txt = txt.append(txt);
  // concatenation of strings
  std::string s1 = "This is a ";
	std::string s2 = "concatenated string.";
	txt = s1 + s2;
  //length/size of string (both works)
  txt.length();
  txt.size();
  //CharAt
  txt[0];
  txt[2]='J';
  
  
}