for (int i = 0; i < str.length(); i++) { for (int i = 0; i <str.length(); i++):初始化一个索引变量 i,从 0 开始,直到 …