cleanup and bruteforce string matching

Made the functions more useful by returning the sorted array instead of
printing it out within the function, which led me to realise the arrays
werent being copied properly, the .splice() method fixed that.
The printArray method now prints to the screen instead of the console,
makes it a lot easier to read.
Also added the first of (hopefully) many string related search
algorithms.