Every person indicted or presented in any court or tried on state warrants charging driving while intoxicated, or carrying a deadly weapon with the intent to be armed, tried in a court of general sessions, for a misdemeanor, except when acquitted, before the person is discharged, shall be required by the judgment of the court to pay or secure or work out in the workhouse, in addition to all other costs, a county expense fee of five dollars ($5.00) for each defendant. The county expense fee shall be included and recovered as part of the costs of the case, and collected and paid over as costs. The county expense fee shall be paid to the county.