I have a string, let's say "THESTRINGHASNOSPACES". I am a programmer and an Open Source enthusiast. You could do this manually or using the IndexOf method. // Welcome to FavTutor The following example uses the Substring method to separate key/value pairs that are delimited by an equals (=) character. Enter the position from which to start the substring (Index starts from 0): 8. User without create permission can create a custom object from Managed package using Custom Rest API, Ubuntu won't accept my choice of password, Adding EV Charger (100A) in secondary panel (100A) fed off main (200A). They are How to replace a substring of a string - GeeksforGeeks In my opinion for such simple problems its better to point to right direction than give full code for copy&paste adrian - i was basing my edginess on the fact that the question explicity asked : Substring result what i want to display is: ok, I've edited my answer so it is clear that this is only example of using substring :), First, you should post your code as text, the image can be broken link and cannot be searched. if we write: s.substr(s.begin(),3) => compilation error (because cannnot convert a iterator to a int datatype ), s.substr(2,3) => llo (three letter from 2nd index), s.substr(*s.begin()-s[0],3) => hel (s.begin() is h then h-s[0]=> h-h=0 means substr(0,3) three letter from zeroth index, s.substr(5,1) => (prints blank space , that is at 5th index), s.substr(2,0) => (not output) (selects zero letters from second index). You don't need the string.h library in this program, nor the stdbool.h library. You can modify it to fit your needs. acknowledge that you have read and understood our, Data Structure & Algorithm Classes (Live), Data Structures & Algorithms in JavaScript, Data Structure & Algorithm-Self Paced(C++/JAVA), Full Stack Development with React & Node JS(Live), Android App Development with Kotlin(Live), Python Backend Development with Django(Live), DevOps Engineering - Planning to Production, GATE CS Original Papers and Official Keys, ISRO CS Original Papers and Official Keys, ISRO CS Syllabus for Scientist/Engineer Exam, Interview Preparation For Software Developers, Please try your approach on IDE first, before. Strings in C (With Examples) - Programiz Compile and Run the program using GCC compiler (Any compiler).