correct static string clearing loop (closes #16906)