I give! And generally teach math part, due to the freebies in the toaster will not last long.
static void Main(string[] args)
{
var str = "{1/2/4}{1/3/3}{2/2/3}{1/1/3}";
var number = new [] { "3", "2", "1", "2" };
var temp = str
.Trim('{', '}')
.Split(new []{ "}{" }, StringSplitOptions.None)
.Select(x => x.Split('|').ToArray())
.ToArray();
var result = new StringBuilder();
for (var i = 0; i < temp.Length; i++)
{
var isParse = int.TryParse(number[i], out int index);
if (isParse)
{
result.Append(temp[i][index - 1]);
}
}
Console.WriteLine(result);
Console.ReadKey();
}
string str = "{1/2/3} text {1/2/3} tut {1/2/3} no and {1/2/3} where"
I was using Replace():
- kirk22 commented on June 10th 19 at 14:28
Now another option distribute. But it will be quick. - Abner32 commented on June 10th 19 at 14:31
- Abner32 commented on June 10th 19 at 14:37
- Abner32 commented on June 10th 19 at 14:49