Playing with Strings
Posted
by HARSHITH
on Stack Overflow
See other posts from Stack Overflow
or by HARSHITH
Published on 2010-06-16T03:30:58Z
Indexed on
2010/06/16
3:32 UTC
Read the original article
Hit count: 212
Given a string and a non-empty word string, return a string made of each char just before and just after every appearance of the word in the string. Ignore cases where there is no char before or after the word, and a char may be included twice if it is between two words.
wordEnds("abcXY123XYijk", "XY") ? "c13i"
wordEnds("XY123XY", "XY") ? "13"
wordEnds("XY1XY", "XY") ? "11"
© Stack Overflow or respective owner