Search
 
SCRIPT & CODE EXAMPLE
 

CPP

c++ recorrer string

std::string s = "Hola-perro-Cosa";
int init = 0;
int end = 0;
while( end = s.find("-", init), end >= 0 )
{
  std::cout << s.substr(init, end - init) << '
';
  init = end + 1;
}
std::cout << s.substr(init);
Comment

PREVIOUS NEXT
Code Example
Cpp :: what is a variable in cpp 
Cpp :: c++ map lookup 
Cpp :: c++ polymorphism 
Cpp :: what is function c++ 
Cpp :: how to fill vector from inputs c++ 
Cpp :: three way comparison operator c++ 
Cpp :: potato 
Cpp :: volumeof a sphere 
Cpp :: find maximum sum in array of contiguous subarrays 
Cpp :: C++ if...else...else if statement 
Cpp :: c++ std map initializer list 
Cpp :: c++ catch Unhandled exception 
Cpp :: c++ write to file in directory 
Cpp :: how can I delete a substring from a string in c++? 
Cpp :: string c++ 
Cpp :: c++ hash 
Cpp :: c++ function pointer as variable 
Cpp :: valid parentheses in c++ 
Cpp :: know what the input data is whether integer or not 
Cpp :: c++ get index of map element 
Cpp :: ? c++ 
Cpp :: C++ programming code to remove all characters from string except alphabets 
Cpp :: InstallUtil.exe ConsoleApp 
Cpp :: c++ the hash function with 31 const 
Cpp :: uint16_t in c++ 
Cpp :: binary to int c++ bitset 
Cpp :: nand in cpp 
Cpp :: PascalName seperate strings 
Cpp :: Z-function 
Cpp :: vector with initial size 
ADD CONTENT
Topic
Content
Source link
Name
2+1 =