Hi, i'm leanrning C# and I

Hi, I’m trying to make a form where they enter sentence(s) which will be filtered through string replacement. After string replacement trying to display the data in the text field on the same screen.
From doing search, I go to a point as below.

I was able to get the data using “GetInput(string Data)” & string replace by "ReplaceText() "
But I cannot place the “Data” as a “public string SubmitText = “”;”

How do I get that input Data to be a string so that I can do the string replace then display?

I know it is from not understanding how C# works, but it will be really helpful to move one step forward to my learning.

Thank you


public void Submit(){
    ReplaceText();
    SetText2.GetComponent<Text>().text = SubmitText;
}
//..
//Get and set text to text field
public GameObject SetText2;
public void GetInput(string Data){
    Debug.Log("what is data = " + Data);
    SetText2.GetComponent<Text>().text = Data;
}

//..
// Get Data and replace with X
public string SubmitText = "";
public string errorWord = ",";
public string searchWord = " ";

public void ReplaceText()    {
    SubmitText = SubmitText.Replace(errorWord, "");
    SubmitText = SubmitText.Replace(searchWord, ",");
}

Data is already an string

SubmitText = Data;