string teststring = "ich bin First und du bist Second okay";
string newString = teststring.Substring(teststring.IndexOf("First"), teststring.IndexOf("Second"));
What Vloxxity said was good. If you have a RichTextBox you can do it like that:
Code:
string teststring = RichTextBox1.Text; //Should be clear
string newString = teststring.Substring(teststring.IndexOf("First"), teststring.IndexOf("Second"));
// Or a 1-line Code:
string newString = RichTextBox1.Text.Substring(RichTextBox1.Text.IndexOf("First"), RichTextBox1.Text.IndexOf("Second"));
Credits to Vloxxity
Is that what you are searching for? The methode Vloxxity posted was enough to archieve that. And I don't think you are a C&P-Kiddie, who can't apply general methods to specific problems (then you should stop programmming immediately).
Best regards
Jeoni
the richbox I have has more than 500 lines I want to search for the unique text "FIRST" and the other unique text "Second" and get the text between then
EX. a line container this "First time I code in C# and it is my Second time"
of meaningless sentence cuz I don't have example now but I want to get that text "time I code in C# and it is my"
NOTE: The rich box has more than 500 lines I want the fastest way to get the results desired
public class SplitDefinition
{
public SplitDefinition(char delimiter, string[] splits)
{
this.delimiter = delimiter;
this.splits = splits;
}
public char delimiter { get; set; }
public string[] splits { get; set; }
}
then use List to store your results
Code:
public List<SplitDefinition> CustomSplit(string source, char[] delimiters)
{
List<SplitDefinition> splitDefinitionList = new List<SplitDefinition>();
foreach(char d in delimiters)
{
SplitDefinition sd = new SplitDefinition(d, source.Split(d));
splitDefinitionList.Add(sd);
}
return splitDefinitionList;
}
and init it
Code:
void Main()
{
string text = "First time I code in C# and it is my Second time";
List<SplitDefinition> splitDefinitionList = CustomSplit(text, new char[] { 'First', 'Second' });
}
[VB08]String in String mit mehreren Funden 08/08/2011 - .NET Languages - 6 Replies Hey,
bin gerade auf ein Problem gestoßen, an dem ich mir seit 3 Stunden die Zähne ausbeiße.
Ich will eine Funktion schreiben, die der _StringBetween Funktion von AutoIt gleich ist. _StringBetween gibt in einem Array alle Strings zwischen zwei SubStrings und dem ganzen String aus. Die Ausgabe bei
_StringBetween("<h1>test1</h1>&l t;h1>test2</h1>", "<h1>", "</h1>") wäre also idealer Weiße ein Array (x = "test1", x = "test2")...
da man in VB08 kein Array returnen kann, komme ich aber einfach...
[C++] string zwischen string 11/11/2010 - C/C++ - 6 Replies tag gibts direkt ne funktion, mit der man einen passenden string zwischen dem string suchen kann?
also meine net .find() sondern sowas ähnliches, die in diesem beispiel "mein string sucht"
Bsp:
"<span id=\"lalala\">"+string mein_string+"</span>"
understanden? :-)
How to... lvl a bard on stings with openkore 06/21/2006 - Ragnarok Online - 5 Replies Hello guys.
I tried to use openkore on the gh-stings map, but my problems are the following:
when i use this one:
runFromTarget 1
runFromTarget_dist 6
he runs to far away, and mostly directly into the next sting so that he has to teleport.