Click here to Skip to main content
Rate this: bad
good
Please Sign up or sign in to vote.
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?
Posted 8-Oct-12 4:56am
Abhi KA1.9K
Edited 8-Oct-12 5:01am
v2
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 1

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);
       }
  Permalink  
Comments
Abhiram KA at 8-Oct-12 10:08am
   
split by words how?
Abhiram KA at 8-Oct-12 10:08am
   
delimiter i know
Rate this: bad
good
Please Sign up or sign in to vote.

Solution 2

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
    );
This woudl give you three groups, broken as you wanted.
  Permalink  

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



Advertise | Privacy | Mobile
Web01 | 2.8.1411022.1 | Last Updated 8 Oct 2012
Copyright © CodeProject, 1999-2014
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100