Answers for "extract characters from string c++"

C++
4

index string c++

#include <string>
#include <iostream>

int main(){
  //index string by using brackets []
  std::string string = "Hello, World!";
  //assign variable to string index
  char stringindex = string[2];
  
}
Posted by: Guest on June-15-2020
0

c++ get character from string

#include <iostream>
#include <string>

int main() {
    std::string myStr = "test string";

    for (int i = 0; i < myStr.length(); ++i) {
        std::cout << myStr.at(i) << std::endl;
    }

    return 0;
}
Posted by: Guest on March-29-2021

Code answers related to "extract characters from string c++"

Browse Popular Code Answers by Language