Control of F-doping in pnictide high-temperature superconductors