Horje
cpp substring Code Example
cpp substring
#include <iostream>
#include <string>

using namespace std;

void cpp_strings()
{
    string unformatted_full_name { "StephenHawking" };

    string first_name = unformatted_full_name.substr(0, 7);
    // string first_name { unformatted_full_name, 0, 7 };
    string last_name = unformatted_full_name.substr(7, 7);
    string formatted_full_name = first_name + last_name;

    formatted_full_name.insert(7, " ");
    cout << formatted_full_name;
}

int main()
{
    cpp_strings();
    return 0;
}
substring function in c++
string sub_string=main_string.substr(first_pos_of_the_substring_from_main_string,length_of_the_substring_from_main_string_starting_from_the_first_position




Cpp

Related
Implementation of Extended Euclidian theorem Code Example Implementation of Extended Euclidian theorem Code Example
c++ lettura file Code Example c++ lettura file Code Example
c++ pass char array by reference Code Example c++ pass char array by reference Code Example
stl function to reverse an array Code Example stl function to reverse an array Code Example
string.begin() c++ Code Example string.begin() c++ Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
8