I have been told that the Catholic Church teaches that anyone who commits suicide goes to hell. Is this true?
No. What the Church teaches is that anyone who commits a mortal sin and does not repent before death goes to hell. Mortal sin requires three conditions: grave matter, full knowledge of the gravity of the action, and full and free consent to the action. If any of those three conditions are missing, there is not mortal sin. All we can say for certain is that suicide constitutes grave matter. Given the fact that people who take their own lives often are very ill or under psychological stress, those factors can impede their knowledge and consent, making their actions tragic but not mortally sinful. Only someone who freely chooses to commit suicide with full knowledge of the gravity of the sinfulness would commit mortal sin by his suicide. Even then, between unconsciousness and final death, God might offer the person one final chance to repent, even if such an opportunity is not apparent to us.
The Church says this about the eternal destiny of those who have taken their own lives: “We should not despair of the eternal salvation of persons who have taken their own lives. By ways known to him alone, God can provide the opportunity for salutary repentance. The Church prays for persons who have taken their own lives” (CCC 2283).