The crux of the solution requires you to use Reflection to locate the required method. This is a simple example covering your sitaution;
private string DoFormat(string data, string format)
{
MethodInfo mi = typeof (string).GetMethod(format, new Type[0]);
if (null == mi)
throw new Exception(String.Format("Could not find method with name '{0}'", format));
return mi.Invoke(data, null).ToString();
}
You can make the method more generic, to accept arguments to the method you want to call, as below. Note the change to the way .GetMethod and .Invoke are called to pass the required arguments.
private static string DoFormat(string data, string format, object[] parameters)
{
Type[] parameterTypes = (from p in parameters select p.GetType()).ToArray();
MethodInfo mi = typeof(string).GetMethod(format, parameterTypes);
if (null == mi)
throw new Exception(String.Format("Could not find method with name '{0}'", format));
return mi.Invoke(data, parameters).ToString();
}