We have been playing with strings and doing some basic operations on string for the last two posts. Another such interesting operation with strings is finding one string in another string. There are a number of things to be checked while searching for a string as a substring of second one. We shall be explaining these steps and other details in the proceeding lines.
Posts Tagged ‘cstrings’
Human Beings like to play with string in their daily life. We deal with all sorts of alphabets and words and often try to compare them with one another. To check whether we have two given set of characters equal or not, we make use of string matching algorithms. To match the two given strings, we use then to look for equality in both the strings for the desired results. A simple string matching algorithm is to iterate over each alphabet and match correspondingly. Let us see in detail how we do that.
After some really heavy programming concepts, let us explore some lighter side of programming for a while and then we’ll return back to where we started. This time we would have a go at Cstrings. Cstrings are character arrays having a null terminator ‘\0′ at its end. Right. So lets see what we are trying to do.