1

想不通,为什么这是分成 3 部分而不是 2 部分?

myRichTextboxEx.Rtf = "{\rtf1\ansi\ansicpg1252\deff0\nouicompat\deflang1043\deflangfe1043\deftab708{\fonttbl{\f0\fnil\fcharset0 Segoe UI;}{\f1\fswiss\fprq2\fcharset0 Verdana;}{\f2\fmodern\fprq1\fcharset0 Lucida Console;}{\f3\froman\fprq2\fcharset0 Times New Roman;}}  {\colortbl ;\red0\green0\blue255;}  {\*\generator Riched20 6.3.9600}\viewkind4\uc1   \pard\nowidctlpar\sl276\slmult1\tx1276\tx2130\tx3124\f0\fs18           \f1\fs36\par    \pard\nowidctlpar\sl276\slmult1\tx3000\f2\fs17             Eemplein 20\line          3812 EA Amersfoort\line         {{\field{\*\fldinst{HYPERLINK www.kingoftheribs.nl }}{\fldrslt{www.kingoftheribs.nl\ul0\cf0}}}}\f2\fs17\line            033-8887088\par    \pard\nowidctlpar\sl276\slmult1\qc\tx3000\par    \pard\nowidctlpar\sl276\slmult1\tx3000\line B.J. van Logtestijn\line Prins Frederiklaan 57C   \line 3818KB \line Amersfoort\line T1:06=41191965 T2: T3:\line\b   \par  \fs30 Bon #1\line\b0\fs18\line\line\line 1 x Durum Chicken\tab       3,95 \line\line 1 x Turkse pizza (lamacun)\tab       1,95 \line\li
ne 1 x Turkse pizza sla en saus\tab       2,50 \line     \i Groot ben&Jerry's (3,5)\i0\line\line 1 x Gegra. aardappel\tab       3,00 \line\line 1 x Kapsalon menu kebab Medium\tab       5,95 \line\line 1 x Drumsticks Menu 3st\tab       5,95 \line\line 1 x Kinder Menu Ribs\tab       3,75 \line\par  Totaal:\tab      30,55\line Korting:\tab       0,00\line\fs20 Te voldoen:\fs18\tab      30,55\par  Betaald met:\tab <BEDRAGBETAALDMET>\par  Wisselgeld:\tab     -30,55\par   \b\fs24\line\b0\fs18 Btw 6,00 % over 30,55:\tab       1,73 \b\fs24\line\b0\fs18 Btw 21,00 % over 0,00:\tab       0,00\par  \par  Aflevertijd:  \par  \fs17 Betaalwijze:\b\fs24  Contant\b0\fs17  \par  \par  \f1 29-10-2013   29-10-2013 16:47:50\par  \f2                          \fs24\par    \pard\nowidctlpar\sl276\slmult1\qc\tx3000\fs22 Bedankt voor uw bestelling\par  en eet smakelijk!!!\f1\lang19\par    \pard\nowidctlpar\sl276\slmult1\tx3000\par  <CUTHERE>-----------------------------------\par  \b\f2\fs30\lang1043 Ordernummer 1\par    \pard\nowidctl
par\sa200\sl276\slmult1\b0\f3\fs22 --------------------------------------------------\par  }  "

Dim SplitRTFmessage As String() = myRichTextboxEx.Rtf.Split("<CUTHERE>")
4

2 回答 2

4

您使用了错误的重载(这个期望 aChar不是 a String)。您正在寻找的是:

Dim SplitRTFmessage As String() = myRichTextboxEx.Rtf.Split(New String() {"<CUTHERE>"}, StringSplitOptions.None)

这是使用字符串作为分隔符的正确方法(您拥有的替代方法之一),从而提供正确的结果(2 部分)。

于 2013-10-29T16:26:12.407 回答
1

造成这种情况的原因是您用于 split 的重载实际上是一个字符数组而不是字符串。结果,它正在分裂<

于 2013-10-29T16:26:21.370 回答