//none of these work correctlyAString.Join('\', ['Windows', 'System32']); //this doesn't do anything
Also, it would be nice to have a "PathJoin" helper which automatically uses the correct OS path separator and normalizes the path to remove double separators and fix wrong separators
Wayne, it does not work as you expect, that is not necessarily a bug.
MyString := MyString.Join(PathDelim, [LeftBit, MyString, RightBit]); // MyString is now 'left/abc/right'If Join automatically inserted its own value into the set, as you seem to expect, the code above would give a different result. But if that was the case, would you expect it to add it as the first item in the set, the last item in the set or the middle item (where I want it)
Quote from: dbannon on May 03, 2022, 02:30:52 amWayne, it does not work as you expect, that is not necessarily a bug.Yes, I agree it is not a bug. I just find it not intuitive when Lazarus code completion recommends helpers that (in my opinion) should not be showing up on a string instance since those functions don't operate on it.
Yes, I agree it is not a bug. I just find it not intuitive when Lazarus code completion recommends helpers that (in my opinion) should not be showing up on a string instance since those functions don't operate on it.
Quote from: WayneSherman on May 03, 2022, 06:38:19 amYes, I agree it is not a bug. I just find it not intuitive when Lazarus code completion recommends helpers that (in my opinion) should not be showing up on a string instance since those functions don't operate on it.That's a Lazarus IDE issue and should be discussed (and improvements contributed) elsewhere. The only possible way that that would impact on FPC as a language and on the RTL/FCL would be if the Lazarus team requested that function source be annotated to allow the IDE to improve its completion suggestions.
Nothing needs to be annotated there, because the method is marked as class. Maybe Lazarus then needs to improve its completion display, because one can't easily differentiate between a class and an instance method. However calling a class method on an instance is valid code and thus the suggestion of that function by itself is valid as well.