EVerytime I write any code similar to this one, I get this type of error. It\'s building a file but not letting it run, it just throws exception. I\'m not familiar with exce
You should write the for cycle as
for (int i = 0; i < name.length(); i++)
The indexes in the strings are zero-based, as in the arrays, so they have a range from 0 to length - 1. You go to length, which is outside of bounds.