An object-oriented and type-safe programming language that has its roots in the C family of languages and includes support for component-oriented programming.
If you're looking to parse the string in a fixed format (such as from a data file) then regular expressions are the most common approach provided the pattern is relatively straightforward. The Regex class is designed for this. There are quite a few Regex testers floating around online for you to test with. Personally I used the Regex Editor Lite VS extension but you can use anything to verify your expression.
You need to capture 2 sets of values, the value and the percentage therein so you have to use capture groups.
var re = new Regex(@"^(?<percent>\d+)%\s+of\s+(?<value>\d+)$", RegexOptions.IgnoreCase | RegexOptions.Singleline | RegexOptions.IgnorePatternWhitespace);
var match = re.Match(input);
if (match.Success)
{
//Since using regex here we'll assume the values are good but could still fail with large integers
var percentage = Int32.Parse(match.Groups["percent"].Value);
var value = Int32.Parse(match.Groups["value"].Value);
}
If you need to do this only once then you can simplify the code to using the Regex.Match static method instead but if you need it more than once then create a static instance instead for perf reasons.