correct static string clearing loop (closes #16906)
merge 3.3 (#16906)