使用{{Vlaue}}进行字符串分割 [英] string Splitting with {{ Vlaue}}

查看:127
本文介绍了使用{{Vlaue}}进行字符串分割的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

进度帐单将在适用时开具发票,并受相同条款的约束.万一{{businessName}}有必要执行本协议的任何规定

我需要

progress billings made to meet project requirements will be invoiced when applicable and subject to the same terms. In the event it shall become necessary for {{businessName}} to enforce any of the provisions of this agreement

i need

string v1="progress billings made to meet project requirements will be invoiced when applicable and subject to the same terms. In the event it shall become necessary for" ;
string v2="{{businessName}}";
string v3="to enforce any of the provisions of this agreement";


请怎么做?


please how to do?

推荐答案

string words = "This is a list of words, with: a bit of punctuation" +
                      "\tand a tab character.";

       string [] split = words.Split(new Char [] {' ', ',', '.', ':', '\t' });

       foreach (string s in split) {

           if (s.Trim() != "")
               Console.WriteLine(s);
       }


有很多方法可以做到这一点-我可能会使用正则表达式:
There are a lot of ways to do this - I would probably use a regex:
public static Regex regex = new Regex(
      "(.*?)\\s({{.*?}})\\s(.*)",
    RegexOptions.IgnoreCase
    | RegexOptions.Multiline
    | RegexOptions.Singleline
    | RegexOptions.CultureInvariant
    | RegexOptions.Compiled
    );

此wodl会给您三组,按您的意愿进行分组.

This woudl give you three groups, broken as you wanted.


这篇关于使用{{Vlaue}}进行字符串分割的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆