mod substr idx num beg from 1 to 0