Can you please exlain

how we formulated conversion of string to numbers in this

for(int i=0;i<str.size();i++)
{
sum=sum*10+str[i]-‘0’;
}