Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
StrSubCpyFind
//g++ 7.4.0 ////////////////////////////////////////////////////////////////////////////////StrSubCpyFind //this code is created by Rezaul Hoque on July 14,2022; //contact:jewelmrh@yahoo.com;Dhaka,Bangladesh;https://rezaulhoque.wordpress.com,https://hoquestake.blogspot.com //note: codes shared by Rezaul Hoque on rextester are not for sale; they are created and shared to facilitate the algorithm learning process; many like Hoque use this platform to practice programming ;Rezaul hopes his contribution helps others to fine tune their learning; /////////////////////////////////////////////////////////////////////////// #include <iostream> #include <string> int main() { std::string a= "Hi there! How are you?\n"; std::string sub=a.substr(9,a.size()-9); std::cout<<sub<<"\n"; try{ std::string s2=a.substr(a.size()+2,3); std::cout<<s2<<" \n"; }catch(const std::out_of_range& m) { std::cout<<"Size limit of string is crossed!\n";} char copied[23]{}; a.copy(copied,sizeof copied); std::cout<<copied<<"\n"; std::string::size_type n; n=a.find("you",9); if(n==std::string::npos) {std::cout<<"not found.\n";} else {std::cout<<a.substr(n);} return 0; }
run
|
edit
|
history
|
help
0
Continuous Sub Set with given sum
F-Random Strings
BOOST_ENABLE_ASSERT_HANDLER defined
Boost phoenix e.g. 1 no functor
homework
copy_if c++98
Eratosfen final
string-Orderly words
A string-integer comparison trick
Изволов#8