How can I split the string using c++, and then choose the last part of that?












0















I wanna split a string and then print the number of string, and print the last string inside the delimiter?



std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
std::string delimiter = ">=";

size_t pos = 0;
std::string token;
while ((pos = s.find(delimiter)) != std::string::npos) {
token = s.substr(0, pos);
std::cout << token << std::endl;
s.erase(0, pos + delimiter.length());
}
std::cout << s << std::endl;


I wanna calculate the number of the string, and print the last part of this string like this i need print the :
3
abcd










share|improve this question




















  • 1





    What does number of the string mean? Why is it 3 in this example? And what is your question in relation to the code? Does it not work as expected?

    – user10605163
    Nov 25 '18 at 4:54













  • 3 is the number of >=scott>=tiger>=mushroom>=, delete the "=>", and the abcd is the last part of them. The result should print

    – Andy Cui
    Nov 25 '18 at 22:56
















0















I wanna split a string and then print the number of string, and print the last string inside the delimiter?



std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
std::string delimiter = ">=";

size_t pos = 0;
std::string token;
while ((pos = s.find(delimiter)) != std::string::npos) {
token = s.substr(0, pos);
std::cout << token << std::endl;
s.erase(0, pos + delimiter.length());
}
std::cout << s << std::endl;


I wanna calculate the number of the string, and print the last part of this string like this i need print the :
3
abcd










share|improve this question




















  • 1





    What does number of the string mean? Why is it 3 in this example? And what is your question in relation to the code? Does it not work as expected?

    – user10605163
    Nov 25 '18 at 4:54













  • 3 is the number of >=scott>=tiger>=mushroom>=, delete the "=>", and the abcd is the last part of them. The result should print

    – Andy Cui
    Nov 25 '18 at 22:56














0












0








0


0






I wanna split a string and then print the number of string, and print the last string inside the delimiter?



std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
std::string delimiter = ">=";

size_t pos = 0;
std::string token;
while ((pos = s.find(delimiter)) != std::string::npos) {
token = s.substr(0, pos);
std::cout << token << std::endl;
s.erase(0, pos + delimiter.length());
}
std::cout << s << std::endl;


I wanna calculate the number of the string, and print the last part of this string like this i need print the :
3
abcd










share|improve this question
















I wanna split a string and then print the number of string, and print the last string inside the delimiter?



std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
std::string delimiter = ">=";

size_t pos = 0;
std::string token;
while ((pos = s.find(delimiter)) != std::string::npos) {
token = s.substr(0, pos);
std::cout << token << std::endl;
s.erase(0, pos + delimiter.length());
}
std::cout << s << std::endl;


I wanna calculate the number of the string, and print the last part of this string like this i need print the :
3
abcd







c++ split






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Nov 25 '18 at 10:51









Gunasekar

5221517




5221517










asked Nov 25 '18 at 4:34









Andy CuiAndy Cui

6




6








  • 1





    What does number of the string mean? Why is it 3 in this example? And what is your question in relation to the code? Does it not work as expected?

    – user10605163
    Nov 25 '18 at 4:54













  • 3 is the number of >=scott>=tiger>=mushroom>=, delete the "=>", and the abcd is the last part of them. The result should print

    – Andy Cui
    Nov 25 '18 at 22:56














  • 1





    What does number of the string mean? Why is it 3 in this example? And what is your question in relation to the code? Does it not work as expected?

    – user10605163
    Nov 25 '18 at 4:54













  • 3 is the number of >=scott>=tiger>=mushroom>=, delete the "=>", and the abcd is the last part of them. The result should print

    – Andy Cui
    Nov 25 '18 at 22:56








1




1





What does number of the string mean? Why is it 3 in this example? And what is your question in relation to the code? Does it not work as expected?

– user10605163
Nov 25 '18 at 4:54







What does number of the string mean? Why is it 3 in this example? And what is your question in relation to the code? Does it not work as expected?

– user10605163
Nov 25 '18 at 4:54















3 is the number of >=scott>=tiger>=mushroom>=, delete the "=>", and the abcd is the last part of them. The result should print

– Andy Cui
Nov 25 '18 at 22:56





3 is the number of >=scott>=tiger>=mushroom>=, delete the "=>", and the abcd is the last part of them. The result should print

– Andy Cui
Nov 25 '18 at 22:56












1 Answer
1






active

oldest

votes


















1














Edit: I added a minimal solution.





A Minimal Solution



Assuming that I understand the problem correctly, the way I would do it is to define a proper splitting function.
Since split empty strings seem to be ignored in your definition of split, I expect that the following splitting function solves the current problem.
This function counts the number of non-empty strings and finally create the last non-empty string:



std::pair<std::size_t, std::string> 
check(const std::string& str, const std::string& delimiter)
{
std::size_t count = 0;
auto begin = str.begin();
auto end = str.begin();

for(auto it = str.begin();
it != str.cend();
it += ((it == str.cend()) ? 0 : delimiter.length()) )
{
const auto preit = it;
it = std::search(preit, str.cend(), delimiter.cbegin(), delimiter.cend());

if(it != preit)
{
++count;
begin = preit;
end = it;
}
}

return { count, std::string(begin, end) };
}


Using this splitting function as follows, we can get the desired output 3 abcd.



DEMO is here.



std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
std::string delimiter = ">=";

const auto result = check(s, delimiter);
if(result.first != 0){
std::cout << (result.first - 1) << " " << result.second << std::endl;
}




General Splitting Functions



If other non-empty split strings are also needed, it is desirable to implement a more general splitting function.
Also, since general splitting functions would be useful in other problems and thus I think this is a good opportunity to do it.
Creating strings in if-section of the above function check and emplacing back it to std::vector, we get a more general splitting function:



std::vector<std::string> 
split(const std::string& str, const std::string& delimiter)
{
std::vector<std::string> strings;

for(auto it = str.begin();
it != str.cend();
it += ((it == str.cend()) ? 0 : delimiter.length()) )
{
const auto preit = it;
it = std::search(preit, str.cend(), delimiter.cbegin(), delimiter.cend());

if(it != preit){
strings.emplace_back(preit, it);
}
}

return strings;
}


Using this splitting function as follows, we again get the desired output 3 abcd.



DEMO is here.



std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
std::string delimiter = ">=";

const auto strings = split(s, delimiter);

if(!strings.empty()){
std::cout << (strings.size() - 1) << " " << strings.back() << std::endl;
}




C++17 and std::string_view



Furthermore, in C++17 and over, std::string_view is also available.
When std::string_view is created there’s no need to copy the data and it would provide a performance effective method.
Thus here I also propose a portable and generic splitting function for both std::string and std::string_view.
Using the almost same ctors of std::string and std::string_view, that is




basic_string(const charT* s, size_type n,
const Allocator& a = Allocator());



and




constexpr basic_string_view(const charT* str, size_type len);



, and defining the following template function with universal reference



template<typename C>
auto split(C&& str, const std::string& delimiter)
{
std::vector<typename std::remove_reference<C>::type> strings;

for (auto p = str.data(), end = p + str.length();
p != end;
p += ((p==end) ? 0 : delimiter.length()) )
{
const auto pre = p;
p = std::search(pre, end, delimiter.cbegin(), delimiter.cend());

if (p != pre)
{
strings.emplace_back(pre, p - pre);
}
}

return strings;
}


, we can split s by delimiter in various ways as follows.



DEMO is here.



// std::string_view
const auto strings = split<std::string_view>(s, delimiter);

// std::string(s: lvalue reference)
const auto strings = split(s, delimiter);

// std::string(s: rvalue)
const auto strings = split(std::move(s), delimiter);





share|improve this answer

























    Your Answer






    StackExchange.ifUsing("editor", function () {
    StackExchange.using("externalEditor", function () {
    StackExchange.using("snippets", function () {
    StackExchange.snippets.init();
    });
    });
    }, "code-snippets");

    StackExchange.ready(function() {
    var channelOptions = {
    tags: "".split(" "),
    id: "1"
    };
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function() {
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled) {
    StackExchange.using("snippets", function() {
    createEditor();
    });
    }
    else {
    createEditor();
    }
    });

    function createEditor() {
    StackExchange.prepareEditor({
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader: {
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    },
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    });


    }
    });














    draft saved

    draft discarded


















    StackExchange.ready(
    function () {
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53464679%2fhow-can-i-split-the-string-using-c-and-then-choose-the-last-part-of-that%23new-answer', 'question_page');
    }
    );

    Post as a guest















    Required, but never shown

























    1 Answer
    1






    active

    oldest

    votes








    1 Answer
    1






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    Edit: I added a minimal solution.





    A Minimal Solution



    Assuming that I understand the problem correctly, the way I would do it is to define a proper splitting function.
    Since split empty strings seem to be ignored in your definition of split, I expect that the following splitting function solves the current problem.
    This function counts the number of non-empty strings and finally create the last non-empty string:



    std::pair<std::size_t, std::string> 
    check(const std::string& str, const std::string& delimiter)
    {
    std::size_t count = 0;
    auto begin = str.begin();
    auto end = str.begin();

    for(auto it = str.begin();
    it != str.cend();
    it += ((it == str.cend()) ? 0 : delimiter.length()) )
    {
    const auto preit = it;
    it = std::search(preit, str.cend(), delimiter.cbegin(), delimiter.cend());

    if(it != preit)
    {
    ++count;
    begin = preit;
    end = it;
    }
    }

    return { count, std::string(begin, end) };
    }


    Using this splitting function as follows, we can get the desired output 3 abcd.



    DEMO is here.



    std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
    std::string delimiter = ">=";

    const auto result = check(s, delimiter);
    if(result.first != 0){
    std::cout << (result.first - 1) << " " << result.second << std::endl;
    }




    General Splitting Functions



    If other non-empty split strings are also needed, it is desirable to implement a more general splitting function.
    Also, since general splitting functions would be useful in other problems and thus I think this is a good opportunity to do it.
    Creating strings in if-section of the above function check and emplacing back it to std::vector, we get a more general splitting function:



    std::vector<std::string> 
    split(const std::string& str, const std::string& delimiter)
    {
    std::vector<std::string> strings;

    for(auto it = str.begin();
    it != str.cend();
    it += ((it == str.cend()) ? 0 : delimiter.length()) )
    {
    const auto preit = it;
    it = std::search(preit, str.cend(), delimiter.cbegin(), delimiter.cend());

    if(it != preit){
    strings.emplace_back(preit, it);
    }
    }

    return strings;
    }


    Using this splitting function as follows, we again get the desired output 3 abcd.



    DEMO is here.



    std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
    std::string delimiter = ">=";

    const auto strings = split(s, delimiter);

    if(!strings.empty()){
    std::cout << (strings.size() - 1) << " " << strings.back() << std::endl;
    }




    C++17 and std::string_view



    Furthermore, in C++17 and over, std::string_view is also available.
    When std::string_view is created there’s no need to copy the data and it would provide a performance effective method.
    Thus here I also propose a portable and generic splitting function for both std::string and std::string_view.
    Using the almost same ctors of std::string and std::string_view, that is




    basic_string(const charT* s, size_type n,
    const Allocator& a = Allocator());



    and




    constexpr basic_string_view(const charT* str, size_type len);



    , and defining the following template function with universal reference



    template<typename C>
    auto split(C&& str, const std::string& delimiter)
    {
    std::vector<typename std::remove_reference<C>::type> strings;

    for (auto p = str.data(), end = p + str.length();
    p != end;
    p += ((p==end) ? 0 : delimiter.length()) )
    {
    const auto pre = p;
    p = std::search(pre, end, delimiter.cbegin(), delimiter.cend());

    if (p != pre)
    {
    strings.emplace_back(pre, p - pre);
    }
    }

    return strings;
    }


    , we can split s by delimiter in various ways as follows.



    DEMO is here.



    // std::string_view
    const auto strings = split<std::string_view>(s, delimiter);

    // std::string(s: lvalue reference)
    const auto strings = split(s, delimiter);

    // std::string(s: rvalue)
    const auto strings = split(std::move(s), delimiter);





    share|improve this answer






























      1














      Edit: I added a minimal solution.





      A Minimal Solution



      Assuming that I understand the problem correctly, the way I would do it is to define a proper splitting function.
      Since split empty strings seem to be ignored in your definition of split, I expect that the following splitting function solves the current problem.
      This function counts the number of non-empty strings and finally create the last non-empty string:



      std::pair<std::size_t, std::string> 
      check(const std::string& str, const std::string& delimiter)
      {
      std::size_t count = 0;
      auto begin = str.begin();
      auto end = str.begin();

      for(auto it = str.begin();
      it != str.cend();
      it += ((it == str.cend()) ? 0 : delimiter.length()) )
      {
      const auto preit = it;
      it = std::search(preit, str.cend(), delimiter.cbegin(), delimiter.cend());

      if(it != preit)
      {
      ++count;
      begin = preit;
      end = it;
      }
      }

      return { count, std::string(begin, end) };
      }


      Using this splitting function as follows, we can get the desired output 3 abcd.



      DEMO is here.



      std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
      std::string delimiter = ">=";

      const auto result = check(s, delimiter);
      if(result.first != 0){
      std::cout << (result.first - 1) << " " << result.second << std::endl;
      }




      General Splitting Functions



      If other non-empty split strings are also needed, it is desirable to implement a more general splitting function.
      Also, since general splitting functions would be useful in other problems and thus I think this is a good opportunity to do it.
      Creating strings in if-section of the above function check and emplacing back it to std::vector, we get a more general splitting function:



      std::vector<std::string> 
      split(const std::string& str, const std::string& delimiter)
      {
      std::vector<std::string> strings;

      for(auto it = str.begin();
      it != str.cend();
      it += ((it == str.cend()) ? 0 : delimiter.length()) )
      {
      const auto preit = it;
      it = std::search(preit, str.cend(), delimiter.cbegin(), delimiter.cend());

      if(it != preit){
      strings.emplace_back(preit, it);
      }
      }

      return strings;
      }


      Using this splitting function as follows, we again get the desired output 3 abcd.



      DEMO is here.



      std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
      std::string delimiter = ">=";

      const auto strings = split(s, delimiter);

      if(!strings.empty()){
      std::cout << (strings.size() - 1) << " " << strings.back() << std::endl;
      }




      C++17 and std::string_view



      Furthermore, in C++17 and over, std::string_view is also available.
      When std::string_view is created there’s no need to copy the data and it would provide a performance effective method.
      Thus here I also propose a portable and generic splitting function for both std::string and std::string_view.
      Using the almost same ctors of std::string and std::string_view, that is




      basic_string(const charT* s, size_type n,
      const Allocator& a = Allocator());



      and




      constexpr basic_string_view(const charT* str, size_type len);



      , and defining the following template function with universal reference



      template<typename C>
      auto split(C&& str, const std::string& delimiter)
      {
      std::vector<typename std::remove_reference<C>::type> strings;

      for (auto p = str.data(), end = p + str.length();
      p != end;
      p += ((p==end) ? 0 : delimiter.length()) )
      {
      const auto pre = p;
      p = std::search(pre, end, delimiter.cbegin(), delimiter.cend());

      if (p != pre)
      {
      strings.emplace_back(pre, p - pre);
      }
      }

      return strings;
      }


      , we can split s by delimiter in various ways as follows.



      DEMO is here.



      // std::string_view
      const auto strings = split<std::string_view>(s, delimiter);

      // std::string(s: lvalue reference)
      const auto strings = split(s, delimiter);

      // std::string(s: rvalue)
      const auto strings = split(std::move(s), delimiter);





      share|improve this answer




























        1












        1








        1







        Edit: I added a minimal solution.





        A Minimal Solution



        Assuming that I understand the problem correctly, the way I would do it is to define a proper splitting function.
        Since split empty strings seem to be ignored in your definition of split, I expect that the following splitting function solves the current problem.
        This function counts the number of non-empty strings and finally create the last non-empty string:



        std::pair<std::size_t, std::string> 
        check(const std::string& str, const std::string& delimiter)
        {
        std::size_t count = 0;
        auto begin = str.begin();
        auto end = str.begin();

        for(auto it = str.begin();
        it != str.cend();
        it += ((it == str.cend()) ? 0 : delimiter.length()) )
        {
        const auto preit = it;
        it = std::search(preit, str.cend(), delimiter.cbegin(), delimiter.cend());

        if(it != preit)
        {
        ++count;
        begin = preit;
        end = it;
        }
        }

        return { count, std::string(begin, end) };
        }


        Using this splitting function as follows, we can get the desired output 3 abcd.



        DEMO is here.



        std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
        std::string delimiter = ">=";

        const auto result = check(s, delimiter);
        if(result.first != 0){
        std::cout << (result.first - 1) << " " << result.second << std::endl;
        }




        General Splitting Functions



        If other non-empty split strings are also needed, it is desirable to implement a more general splitting function.
        Also, since general splitting functions would be useful in other problems and thus I think this is a good opportunity to do it.
        Creating strings in if-section of the above function check and emplacing back it to std::vector, we get a more general splitting function:



        std::vector<std::string> 
        split(const std::string& str, const std::string& delimiter)
        {
        std::vector<std::string> strings;

        for(auto it = str.begin();
        it != str.cend();
        it += ((it == str.cend()) ? 0 : delimiter.length()) )
        {
        const auto preit = it;
        it = std::search(preit, str.cend(), delimiter.cbegin(), delimiter.cend());

        if(it != preit){
        strings.emplace_back(preit, it);
        }
        }

        return strings;
        }


        Using this splitting function as follows, we again get the desired output 3 abcd.



        DEMO is here.



        std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
        std::string delimiter = ">=";

        const auto strings = split(s, delimiter);

        if(!strings.empty()){
        std::cout << (strings.size() - 1) << " " << strings.back() << std::endl;
        }




        C++17 and std::string_view



        Furthermore, in C++17 and over, std::string_view is also available.
        When std::string_view is created there’s no need to copy the data and it would provide a performance effective method.
        Thus here I also propose a portable and generic splitting function for both std::string and std::string_view.
        Using the almost same ctors of std::string and std::string_view, that is




        basic_string(const charT* s, size_type n,
        const Allocator& a = Allocator());



        and




        constexpr basic_string_view(const charT* str, size_type len);



        , and defining the following template function with universal reference



        template<typename C>
        auto split(C&& str, const std::string& delimiter)
        {
        std::vector<typename std::remove_reference<C>::type> strings;

        for (auto p = str.data(), end = p + str.length();
        p != end;
        p += ((p==end) ? 0 : delimiter.length()) )
        {
        const auto pre = p;
        p = std::search(pre, end, delimiter.cbegin(), delimiter.cend());

        if (p != pre)
        {
        strings.emplace_back(pre, p - pre);
        }
        }

        return strings;
        }


        , we can split s by delimiter in various ways as follows.



        DEMO is here.



        // std::string_view
        const auto strings = split<std::string_view>(s, delimiter);

        // std::string(s: lvalue reference)
        const auto strings = split(s, delimiter);

        // std::string(s: rvalue)
        const auto strings = split(std::move(s), delimiter);





        share|improve this answer















        Edit: I added a minimal solution.





        A Minimal Solution



        Assuming that I understand the problem correctly, the way I would do it is to define a proper splitting function.
        Since split empty strings seem to be ignored in your definition of split, I expect that the following splitting function solves the current problem.
        This function counts the number of non-empty strings and finally create the last non-empty string:



        std::pair<std::size_t, std::string> 
        check(const std::string& str, const std::string& delimiter)
        {
        std::size_t count = 0;
        auto begin = str.begin();
        auto end = str.begin();

        for(auto it = str.begin();
        it != str.cend();
        it += ((it == str.cend()) ? 0 : delimiter.length()) )
        {
        const auto preit = it;
        it = std::search(preit, str.cend(), delimiter.cbegin(), delimiter.cend());

        if(it != preit)
        {
        ++count;
        begin = preit;
        end = it;
        }
        }

        return { count, std::string(begin, end) };
        }


        Using this splitting function as follows, we can get the desired output 3 abcd.



        DEMO is here.



        std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
        std::string delimiter = ">=";

        const auto result = check(s, delimiter);
        if(result.first != 0){
        std::cout << (result.first - 1) << " " << result.second << std::endl;
        }




        General Splitting Functions



        If other non-empty split strings are also needed, it is desirable to implement a more general splitting function.
        Also, since general splitting functions would be useful in other problems and thus I think this is a good opportunity to do it.
        Creating strings in if-section of the above function check and emplacing back it to std::vector, we get a more general splitting function:



        std::vector<std::string> 
        split(const std::string& str, const std::string& delimiter)
        {
        std::vector<std::string> strings;

        for(auto it = str.begin();
        it != str.cend();
        it += ((it == str.cend()) ? 0 : delimiter.length()) )
        {
        const auto preit = it;
        it = std::search(preit, str.cend(), delimiter.cbegin(), delimiter.cend());

        if(it != preit){
        strings.emplace_back(preit, it);
        }
        }

        return strings;
        }


        Using this splitting function as follows, we again get the desired output 3 abcd.



        DEMO is here.



        std::string s = ">=scott>=tiger>=mushroom>=>=abcd>=";
        std::string delimiter = ">=";

        const auto strings = split(s, delimiter);

        if(!strings.empty()){
        std::cout << (strings.size() - 1) << " " << strings.back() << std::endl;
        }




        C++17 and std::string_view



        Furthermore, in C++17 and over, std::string_view is also available.
        When std::string_view is created there’s no need to copy the data and it would provide a performance effective method.
        Thus here I also propose a portable and generic splitting function for both std::string and std::string_view.
        Using the almost same ctors of std::string and std::string_view, that is




        basic_string(const charT* s, size_type n,
        const Allocator& a = Allocator());



        and




        constexpr basic_string_view(const charT* str, size_type len);



        , and defining the following template function with universal reference



        template<typename C>
        auto split(C&& str, const std::string& delimiter)
        {
        std::vector<typename std::remove_reference<C>::type> strings;

        for (auto p = str.data(), end = p + str.length();
        p != end;
        p += ((p==end) ? 0 : delimiter.length()) )
        {
        const auto pre = p;
        p = std::search(pre, end, delimiter.cbegin(), delimiter.cend());

        if (p != pre)
        {
        strings.emplace_back(pre, p - pre);
        }
        }

        return strings;
        }


        , we can split s by delimiter in various ways as follows.



        DEMO is here.



        // std::string_view
        const auto strings = split<std::string_view>(s, delimiter);

        // std::string(s: lvalue reference)
        const auto strings = split(s, delimiter);

        // std::string(s: rvalue)
        const auto strings = split(std::move(s), delimiter);






        share|improve this answer














        share|improve this answer



        share|improve this answer








        edited Dec 1 '18 at 12:14

























        answered Nov 25 '18 at 16:53









        HirokiHiroki

        1,7492316




        1,7492316
































            draft saved

            draft discarded




















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid



            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.


            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function () {
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53464679%2fhow-can-i-split-the-string-using-c-and-then-choose-the-last-part-of-that%23new-answer', 'question_page');
            }
            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            404 Error Contact Form 7 ajax form submitting

            How to know if a Active Directory user can login interactively

            Refactoring coordinates for Minecraft Pi buildings written in Python