When the accused has been convicted or acquitted, or the case against him has been dismissed or otherwise terminated without his express consent, by a court of competent jurisdiction, upon valid complaint or information or other formal charge sufficient in form and substance to sustain a conviction, and after the accused had pleaded to the charge, the conviction or acquittal of the accused or the