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
Find Case Combinations of a String
replace_copy-30-Seconds-of-C++
Minimum Vertices to Traverse Directed Graph
break.cpp
prototype match
Lowest common ancestor in binary tree
Lazy String Tokenizer Class
kadane's algorithm
QuadRootPoint
Comp Conexe