I have looked at this question but this is not working and I have the exact same requirement where I will have to pass the parameter to a custom label
string parameter = 'this is a test';
string label = System.Label.test;
String value = String.format(label, parameter);
System.debug('//' + value);
Here is the error:
Variable does not exist: String