Here is what I got so far. It works as long as there aren't too many spaces in between T1 = (top). Although I still have the same problem, I still can't make it parse out quotations.
When I place a quotation in delimStr
(i.e. String* delimStr = S" = ( ) ' :
" \0 [ ] { } - ";), (3 quotations inside, I will bold inside one) I get these two errors.
error C2015: too many characters in constant
error C2001: newline in constant
I've done a lot of reading and debugging. It seems the best approach would be something of this nature wchar_t temp = L'"'; but I need to save it as a character array and I get errors from that as well. I've tried many different approaches of character arrays and tryed saving it to String. Still can't figure the quotations out. I need help with this, I need it to
parse out the quotations and read inside of it.
Current example of code works. It takes a script file and changes the buttons. As long as the script file is saved in RTF format.
T1 = (top)
T2 = (bottom)
etc.
-
-
scriptString = richTextBox1->Text;
-
scriptReader = new StringReader(scriptString);
-
-
String* delimStr = S" = ( ) ' : \0 [ ] { } - ";
-
Char delimiter[] = delimStr->ToCharArray();
-
String* split[] = 0;
-
int nextChar = 0;
-
String* line = "";
-
String* str;
-
//String* str2;// = str1->Trim(delim->ToCharArray());
-
//str2 = str2->ToString(str1->Trim(delim->ToCharArray()));
-
-
//iterate over the string using the StringReader, printing each line.
-
while(nextChar >= 0)
-
{
-
//reading line by line
-
line = scriptReader->ReadLine();
-
//making sure it read correctly
-
line = line->TrimStart(NULL);
-
for (int x = 0; x < line->Length; x++)
-
{ //line = line->TrimEnd(NULL);
-
split = line->Split(delimiter, x);
-
richTextBox1->AppendText(S"\ncount = {0, 2} ..............");
-
richTextBox1->AppendText(__box(x)->ToString());
-
IEnumerator* myEnum = split->GetEnumerator();
-
-
while (myEnum->MoveNext())
-
{ //line = line->TrimStart(NULL);
-
String* s = __try_cast<String*>(myEnum->Current);
-
richTextBox1->AppendText(S" ");
-
richTextBox1->AppendText("Last s: ");
-
richTextBox1->AppendText(s);
-
-
//if (myEnum->MoveNext()) //save the last s (which is the name)
-
if(myEnum->MoveNext() && s != NULL)
-
{
-
str = s;
-
}
-
}
-
}
-
-
if(line->StartsWith("T1"))
-
{
-
top1->Text = str;
-
defaultText(sender, e, top1);
-
}
-
else if(line->StartsWith("T2"))
-
{
-
top2->Text = str;
-
defaultText(sender, e, top2);
-
}
-
-
richTextBox1->AppendText("\nThis is the str: ");
-
richTextBox1->AppendText(str);
-
richTextBox1->AppendText("\n");
-
//richTextBox1->AppendText(str->StartsWith(hello);
-
//line->Replace(L'B',L'A');
-
//richTextBox1->AppendText(str);
-
richTextBox1->AppendText("\n");
-
-
//check if there's any more lines
-
nextChar = scriptReader->Peek();
-
-
}
-
-
Thanks in advance