...
/Locating Neighbouring Words and Characters
Locating Neighbouring Words and Characters
Learn how to locate the left and right neighboring words of a string.
We'll cover the following...
We'll cover the following...
We will look at together is retrieving neighboring words from arbitrary positions. For example, given the sentence The quick brown fox jumped over the lazy dog
, if we supplied position 6
, we might want to be able to retrieve the word The
on the left and the word brown
on the right. There are a few ways we could approach implementing this. The first idea is to update our previous wordAt
implementation and skip collecting the characters to ...