diff --git a/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx b/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx
index 83c98b0b50f056e2a6b72a569f49ac7e83f6de90..520133cde871b79f0db5be1170f40ea4e80ee321 100644
--- a/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx
+++ b/Modules/Wrappers/ApplicationEngine/src/otbWrapperDocExampleStructure.cxx
@@ -146,7 +146,7 @@ DocExampleStructure::GenerateCLExample( unsigned int exId )
   res = oss.str();
 
   // Suppress last added space
-  res.erase( res.size()-1, 1);
+  res.pop_back();
 
   return res;
 }