Tag: sub
Find and Replace all occurrences of a sub string in C++
In this article we will discuss how to replace all occurrences of a sub string with new string in C++. For example, we have a string i.e. Advertisements “Boost Library is simple C++ Library” And we want replace all occurrences of ‘Lib’ with XXX. Let’s see the different methods to do it, Frequently Asked: Implementing …
Find and Replace all occurrences of a sub string in C++Read More
Find all occurrences of a sub string in a string | C++ | Both Case Sensitive & InSensitive
In this article we will discuss how to find all occurrences / Positions of a sub string in a given string in both case sensitive & case insensitive manner. Find All Case Sensitive Occurrences of a Sub String in a given String Logic: Use std::string::find to search the first occurrence and then go on searching using …
Find all occurrences of a sub string in a string | C++ | Both Case Sensitive & InSensitiveRead More
C++ : How to copy / clone a STL List or Sub List
In this article we will discuss different techniques to clone the whole list or copy just a sub list. Suppose we have a std::list of strings i.e. Advertisements // List of strings std::list<std::string> listOfStrs = { “of”, “is”, “from”, “this”, “at”, “to” }; Now let’s see how to copy this or a sub list from …
Python : How to get list of files in directory and sub directories
In this article we will discuss different methods to generate a list of all files in directory tree. Creating a list of files in directory and sub directories using os.listdir() Python’s os module provides a function to get the list of files or folder in a directory i.e. Advertisements os.listdir(path=’.’) It returns a list of …
Python : How to get list of files in directory and sub directoriesRead More
Python : Check if a String contains a sub string & find it’s index | case insensitive
In this article we will discuss different ways to check if a sub-string exists in another string and if yes then find it’s index. Will also explore ways to check the existence of sub-string in case in-sensitive manner by ignoring case. Check if a String contains another string or character using “in” and “not in” …
Python : Check if a String contains a sub string & find it’s index | case insensitiveRead More
Python: Reverse a list, sub list or list of list | In place or Copy
In this article we will discuss different ways to reverse contents of a list or list of lists. We will also cover scenarios where we create a reverse copy of the list or reverse the contents of the list in place. Suppose we have a list, list_of_num = [51, 52, 53, 54, 55, 56, 57, …
Python: Reverse a list, sub list or list of list | In place or CopyRead More