Yielding approach index (YAI) in stress space was redefined for general application to various strength criteria in this paper. Some problems in YAI function derived on the basis of Mohr-Coulomb strength criterion were pointed out and the function was re-derived and revised. Furthermore, a series of YAI functions for different material strength criteria were derived and expressed uniformly for convenient numerical programming. Finally, the stability and safety of the surrounding rock for an engineering (Qingdao Metro Line No. 3) were visually analyzed by embedding a self-compiling YAI program in the post-processing stage of finite element analysis.