本文介绍了如何使用预期的括号拆分字符串?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个类似
的字符串

I have a string like

string mainstring  =" Daily @f4(@f1(@f3(@f5(P1)))|@f1()) Report @f5()";





这里@ f1,@ f2,@ f3等等都是一个功能。我有一个列表FunctionList,其中包含所有这些函数名称。每个函数返回一个值,然后我将得到完整的句子。





Here @f1, @f2, @f3 etc. each of them is a function. I have a list "FunctionList" with all these name of function. Each function return a value and then I will get the complete sentence.

for(int i=0; i<FunctionList.Count;i++)
            {
                if (mainstring.Contains(FunctionList[i]))
                {
                   // Suppose list contains @f1 so it is also in the mainstring. So I want to get this portin "@f1(@f3(@f5(P1)))" I can locate index where @f1 is stared in the string but I don't know how can I get this mainstring with expected closing bracket !  
                }
            }


Please help me to find out the portion from the mainstring with expected closing parenthesis. 

推荐答案


这篇关于如何使用预期的括号拆分字符串?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

10-23 15:01