In my framework I use this function (I changed it a bit to make it independant):
/**
@name cleanResult
@function
@description clean a string returned by a GET (remove ";#" and "string;#" and null becomes "")
@param {String} str The string to clean
@param {String} [separator=";"] When it's a list we may want to have a different output (see examples)
@return {String} the cleaned string
@example
cleanResult("15;#Paul"); // -> "Paul"
cleanResult("string;#Paul"); // -> "Paul"
cleanResult(";#Paul;#Jacques;#Aymeric;#"); // -> "Paul;Jacques;Aymeric"
cleanResult(";#Paul;#Jacques;#Aymeric;#", ", "); // -> "Paul, Jacques, Aymeric"
*/
function cleanResult(str,separator) {
if (str===null || typeof str==="undefined") return "";
return (typeof str==="string"?str.replace(/;#[0-9]+;#/g,separator).replace(/^[0-9]+;#/,"").replace(/^;#|;#$/g,"").replace(/;#/g,separator).replace(/string;#/,""):str);
}