Convert string to array
When you declare int array[50]; you declare an array of numbers so only numbers can be stored inside it. If you really want an array of strings then declare an array of strings like String array[50]; There was also a a problem that sometime you split the name by comma, sometime by space, and sometime by comma+space. Also your code was missing closing bracket.
The algorithm has to split both by comma and my space and then take only values that have length more than one to avoid inserting empty strings.
String name = &quot;s111, s222, bbbb,cccc &quot;;
String array[50];
int r=0,t=0;
  
for(int i=0;i&lt;name.length();i++)
{
  if(name[i] == ' ' || name[i] == ',')
  {
    if (i-r &gt; 1)
    {
      array[t] = name.substring(r,i);
      t++;
    }
    r = (i+1);
  }
}

for(int k=0 ;k&lt;=t ;k++)
{
  Serial.println(array[k]);
}