Loop to iterate over the characters of the string
for ( int i = 0 ; i < str . Length ; i ++ ) { char c = str [ i ] ; if ( c == ' . ' ) { defangIP += " [ . ] " ; } else { defangIP += c ; } } return defangIP ; }