Are you sure there isn’t 5 dots? That would result in an Ellipsis and a dot. If you are looking for a way of replacing “3 or more dots” with an ellipsis then you could to use a Regular Expressions.
If you declare the regex object and assign a property, build your application you can see what the size difference would be.
I would avoid regex if you don’t need it. Simple fixed string replacement is better done with standard string Replace an ReplaceAll, why complicate things.
In this example, for multiple series of dots to an ellipsis, it’s a good use. There are other options if you don’t want the extra lib included. Scanning the string sequentially, for example. However, avoid code like the following as string concatenation of this type is very slow.
var NewString
Foreach Char as string in MyString
NewString = NewString + Char
Next
Especially if MyString is large. If you are doing lots of string concatenation it is very much worth changing to the code recommended in this article:
It certainly should work. If there are only four .s and all the encodings are correct.
The encodings comments are worth looking into. Is the string in the control UTF8? The “…” and “…” should be as they are literal text and Xojo defaults to UTF8. Put a breakpoint in and check what the debugger has to say about the property. Being pasted in it could be in another encoding.
Yes, it is reproducible. Odd that the debugger claims the length of the typed string is 2. Which likely points to the issue. I think macOS is converting the … to an ellipsis as you type it. Which means that your … is actually starting out as ellipsis plus . and it isn’t the find and replace that is causing the problem.
In fact if you click out of the texture and then back in, without running any code and then use left and right arrow the ellipsis and . can be confirmed as the contents.
The original text comes from LiveText (macOS embedded OCR feature) pasted in the TextArea (default properties) and the three dots stays as is.
I noticed a problem after I coded the replacement for 4,3 and 2 dots to the Ellipsis (sometimes I get only two dots instead of three, four dots were in Aussie texts…).
So, it is a feature, not a bug. I only have to set a replace Ellipsis + Dot to Ellipsis and I’m done on that !