I have a TBX file for vocabulary (Welsh, but I don’t think that matters here…).
The $Name of each vocabulary note contains the Welsh headword, an en-dash, then the English definition. E.g.
am yr ail – alternatively
The prototype has the following code to split the name into two attributes $LangWelsh and $LangEnglish, based on the en-dash (which is only ever used once in a $Name):
(Note that $Names have dumb apostrophes, ' not ’.)
I can work around this with an additional .replace("\","") of course, but I wondered whether this is simply an inevitable artefact of the way split works, or perhaps a bug?
Or more likely, am I doing something wrong?
(BTW, $FirstLetter and $MySet are to deal with the fact that Welsh treats the letters ‘ll’, ‘dd’ etc as single letters, so I need to do some manipulation to get them to sort in the right order…)
[edit: code correction is response to next post. Mea culpa!]
Yes, I see the issue.I don’t think it is .split() so much as the List creation ‘escaping’ a an unclosed single-quote delimited string. Not what you intended, but seemingly the code’s understanding of what it gets. For instance:
$MyList=$Name.split(" – ").replace("\\","");
Still generates a \r in the target List.
Either way, this still is not the desired result. A workaround for now (tested):