Java String Method To Find Substring Javascript