A devise or bequest to a charitable use will be sustained and carried out in this State; and in all cases where there is a general intention manifested by the testator to effect a certain purpose, and the particular mode in which he directs it to be done shall fail from any cause, a court of chancery may, by approximation, effectuate the purpose in a manner most similar to that indicated by the t