Of course the Lord will forgive you. You must simply confess and, according to the 5 conditions of good confession, have a strong resolve to improve. I also once swore, not with masturbation, but an oath... ...and I've really said something. I confessed and I know that God has forgiven me. A Franciscan once said to me very wise words, "God is not a God of punishment, he is a God of Love." Masturbation, yes, is bad, so if you don't want to go back to that, look on the Internet for some prayers to help you get rid of that sin. Maybe a more frequent Eucharist will help, e.g. a few times a week for Mass. If you want, write on priv, maybe I can help you, advise you? Good luck!