Is there an easy way to re-attach the end part of a bathroom pull light switch?
Those are often held on by a knot, if you can open the doodad (assuming it is simply clipped shut) you will be able to thread the string through the hole and make a new knot. With a needle and thread or some glue you can stich/glue the knot to prevent it from undoing again.

There is no need to replace the string itself unless the string is what failed.