To use any delimiter and get first or second part
//To divide string using deimeter - here @ //str: full string that is to be splitted //delimeter: like '-' //part number: 0 - for string befor delimiter , 1 - string after delimiter getPartString(str, delimter, partNumber) { return str.split(delimter)[partNumber]; }