Click here to Skip to main content
15,885,767 members
Please Sign up or sign in to vote.
4.00/5 (1 vote)
See more:
C#
string separate = textBox1.Text;
            string[] wordArray = new string[] {"بلکہ ", "مگر ", "یعنی ", " کیونکہ", "لیکن ", "گویا ", "یعنی", "چنانچہ", " یا "};
            string[] items = separate.Split(wordArray, StringSplitOptions.None);
            textBox2.Text = items[0] + "۔";
            textBox3.Text = items[1];


i use this code to split sub ordinate clause of sentence to another textbox but the problem is that it split the sentences into two text boxes on basis of "and" and "or". how can i only split subordinate clause of sentences from text. while 1st clause and rest of sentences remains in textbox1.
Posted
Updated 14-Apr-15 8:00am
v2
Comments
Matt T Heffron 14-Apr-15 13:45pm    
What you have will split the textBox1.Text on all of the "and" or "or" words (even if they are parts of other words! like "band", "form", ...), and it will put the first two pieces into textBox2 and textBox3, leaving the textBox1 unmodified.

Use the Improve question to show us what your input looks like (an example of what is in textBox1.Text) and what result you expect.
Asad_Iqbal 14-Apr-15 14:20pm    
there u go friend
Matt T Heffron 14-Apr-15 14:43pm    
This isn't what I suggested would help.
This is just a larger list of "words" to split the input.

Show us an example of what is in textBox1.Text (i.e., what the value of separate is).
And then show us what you want in each of the 3 textBoxes, afterwards.

(If you can use an English approximate equivalent, that would help, as many of us will be distracted by the foreign-to-us language...)
PIEBALDconsult 14-Apr-15 13:46pm    
Try a Regular Expression instead.
Sergey Alexandrovich Kryukov 14-Apr-15 15:27pm    
The question is: how you even recognize that a part of a sentence is subordinate part of whole sentence? It could involve such complicated thing as semantic analysis...
—SA

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



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900