Cocaine and Urine tests

After taking cocaine , how long does it take to go out from your system so it cant be traced by urine tests ? Metabolisim no doubt has a part to play , but there must be a general timescale . What about other drugs?