Split a String on a Delimiter in Bash

Your string : A,B,C,D

STR="A,B,C,D"  
IFS=',' read -ra NAMES <<< "$STR"    #Convert string to array

for i in "${NAMES[@]}"; do  
    echo $i >> formatted_users.txt
done