Henry Olive 5 Posted April 25, 2021 I wish everyone a healthy day. MyStr :='Lorem Ipsum '; I want to delete ALL empty/blank strings end of MyStr ( I dont know MyStr has how many empty strings ) Required Result :='Lorem Ipsum' Thank You Share this post Link to post
David Heffernan 2345 Posted April 25, 2021 (edited) ofc, the naming of TrimRight is a bit of a slap in the face for Arabic speakers and other RTL languages!!! Should really be TrimEnd and TrimBeginning or something like that... Edited April 25, 2021 by David Heffernan 1 Share this post Link to post
Dalija Prasnikar 1396 Posted April 25, 2021 1 minute ago, David Heffernan said: ofc, the naming of TrimRight is a bit of a slap in the face for Arabic speakers and other RTL languages!!! Should really be TrimEnd and TrimBeginning or something like that... Android API moved from such ambiguous methods and properties named left/right to start/end so following that rule it would be TrimEnd and TrimStart Share this post Link to post
David Heffernan 2345 Posted April 25, 2021 3 hours ago, Dalija Prasnikar said: TrimEnd and TrimStart I think start should pair with finish, begin pairs with end, from pairs with to, etc. Don't really like start paired with end. 1 Share this post Link to post
Rollo62 536 Posted April 25, 2021 FMX uses terms leading trailing ... Just saying. 1 Share this post Link to post
Dalija Prasnikar 1396 Posted April 25, 2021 5 hours ago, David Heffernan said: I think start should pair with finish, begin pairs with end, from pairs with to, etc. Don't really like start paired with end. Interesting... as non native English speaker, I guess I don't immediately see the difference. Above pairing generally makes sense. In this case, from my perspective TrimBeginning is extremely awkward to write. Share this post Link to post
Dalija Prasnikar 1396 Posted April 25, 2021 38 minutes ago, Rollo62 said: FMX uses terms leading trailing ... Sounds better. Share this post Link to post
David Heffernan 2345 Posted April 25, 2021 24 minutes ago, Dalija Prasnikar said: Sounds better. Yeah, this is much better. And a good matching pair too. Share this post Link to post
David Heffernan 2345 Posted April 25, 2021 25 minutes ago, Dalija Prasnikar said: Interesting... as non native English speaker, I guess I don't immediately see the difference. Above pairing generally makes sense. In this case, from my perspective TrimBeginning is extremely awkward to write. Start goes with finish, begin goes with end for nouns at least. For verbs start and stop are pairs. 1 Share this post Link to post
wuwuxin 28 Posted April 25, 2021 5 hours ago, Dalija Prasnikar said: as non native English speaker By the way -I bought your new book, and found it very well written. The writing style is probably the best (or one of the best) of all the Delphi technical writers whose book I've read. Last time I found such a good technical writer was Delphi in a Nutshell by Ray Lischner . I look forward to more of your books - or maybe you might want to update the Memory Management book considering now Delphi has a uniform memory manager? 1 Share this post Link to post
Dalija Prasnikar 1396 Posted April 26, 2021 7 hours ago, wuwuxin said: By the way -I bought your new book, and found it very well written. The writing style is probably the best (or one of the best) of all the Delphi technical writers whose book I've read. Last time I found such a good technical writer was Delphi in a Nutshell by Ray Lischner . I look forward to more of your books - Thanks! That means a lot 🙂 7 hours ago, wuwuxin said: or maybe you might want to update the Memory Management book considering now Delphi has a uniform memory manager? Since books covers both classic and ARC compilers, unifying memory management does not have huge impact on the book content. Only DisposeOf chapter and few references to mobile (previously ARC) compiler when it comes to reference counting for object references no longer apply. New mobile compilers now behave exactly like classic compiler, and memory management for that one hasn't changed. Eventually, there will be some book update, but not for now. There is not much going on in the memory management area that would warrant updating the book. Share this post Link to post
Fr0sT.Brutal 900 Posted April 26, 2021 14 hours ago, Dalija Prasnikar said: In this case, from my perspective TrimBeginning is extremely awkward to write. Nothing will beat IncludeTrailingPathDelimiter Share this post Link to post
Dalija Prasnikar 1396 Posted April 26, 2021 11 minutes ago, Fr0sT.Brutal said: Nothing will beat IncludeTrailingPathDelimiter Be happy that you are not Cocoa (Objective-C) developer https://github.com/Quotation/LongestCocoa 1 1 Share this post Link to post
Vandrovnik 214 Posted April 26, 2021 15 minutes ago, Fr0sT.Brutal said: Nothing will beat IncludeTrailingPathDelimiter 🙂 Fortunately it is usually enough to type "incl", press Ctrl+space, arrow down, enter. Share this post Link to post
0x8000FFFF 22 Posted April 26, 2021 23 minutes ago, Dalija Prasnikar said: Be happy that you are not Cocoa (Objective-C) developer https://github.com/Quotation/LongestCocoa Although deprecated, I especially like stringByReplacingPercentEscapesUsingEncoding a.k.a. urlDecode. Share this post Link to post
Rollo62 536 Posted April 26, 2021 2 hours ago, Fr0sT.Brutal said: Nothing will beat IncludeTrailingPathDelimiter Dont get your point, there is AutoCompletion I think thats much better to have speaking names than some like AK, DoIt, Run, InTrlPaDel, aThng, .... (I don't care much about the grammar). And since LSP, we can "AutoComplete" within terms too, above you can find by "Inc", "Trail", "Path", "Del" Share this post Link to post
Stefan Glienke 2002 Posted April 26, 2021 1 hour ago, Rollo62 said: And since LSP, we can "AutoComplete" within terms too, above you can find by "Inc", "Trail", "Path", "Del" LSP has nothing to do with that but the filter in the suggestion box. There were several plugins that could do that for ages. Share this post Link to post
Rollo62 536 Posted April 26, 2021 11 minutes ago, Stefan Glienke said: LSP has nothing to do with that but the filter in the suggestion box. There were several plugins that could do that for ages. Maybe so, but since LSP I recognize that this behaviour has changed to older versions. Before it was able to filter only from beginning of terms, now it filters everywhere. Anyway for what reason: Hooray its getting more usable Share this post Link to post
Fr0sT.Brutal 900 Posted April 26, 2021 (edited) OTOH, some old-school C functions are another edge of insanity. itoa? strstr?? And the absolute winner - printf, fprintf, sprintf, snprintf, printf_s, fprintf_s, sprintf_s, snprintf_s, _sprintf_l, swprintf, _swprintf_l, __swprintf_l, sprintf_s, _sprintf_s_l, swprintf_s, _swprintf_s_l, _sprintf_p, _sprintf_p_l, _swprintf_p, _swprintf_p_l, vsprintf, _vsprintf_l, vswprintf, _vswprintf_l, __vswprintf_l, vsprintf_s, _vsprintf_s_l, vswprintf_s, _vswprintf_s_l, _vsprintf_p, _vsprintf_p_l, _vswprintf_p, _vswprintf_p_l, vsnprintf, _vsnprintf, _vsnprintf_l, _vsnwprintf, _vsnwprintf_l, vsnprintf_s, _vsnprintf_s, _vsnprintf_s_l, _vsnwprintf_s, _vsnwprintf_s_l, WTFPRINTF!!! Edited April 26, 2021 by Fr0sT.Brutal 2 Share this post Link to post
luebbe 26 Posted April 26, 2021 Wasn't there also a series of aprintf which allocates the memory before doing the printf stuff? ;) Share this post Link to post
Fr0sT.Brutal 900 Posted April 26, 2021 (edited) 14 minutes ago, luebbe said: Wasn't there also a series of aprintf which allocates the memory before doing the printf stuff? 😉 IDK and I don't dare to go further into that cave of madness %-) there be monsters! Edited April 26, 2021 by Fr0sT.Brutal Share this post Link to post
0x8000FFFF 22 Posted April 27, 2021 Back to the original topic On 4/25/2021 at 10:33 AM, David Heffernan said: ofc, the naming of TrimRight is a bit of a slap in the face for Arabic speakers and other RTL languages!!! Should really be TrimEnd and TrimBeginning or something like that... Funnily enough TrimStart and TrimEnd helper methods exist in TStringHelper, but were deprecated in favor of TrimLeft and TrimRight: TStringHelper = record helper for string { ... } function TrimEnd(const TrimChars: array of Char): string; deprecated 'Use TrimRight'; function TrimStart(const TrimChars: array of Char): string; deprecated 'Use TrimLeft'; { ... } end; Share this post Link to post
Mike Torrettinni 198 Posted April 28, 2021 On 4/25/2021 at 3:42 AM, Henry Olive said: I wish everyone a healthy day. MyStr :='Lorem Ipsum '; I want to delete ALL empty/blank strings end of MyStr ( I dont know MyStr has how many empty strings ) Required Result :='Lorem Ipsum' Thank You Apart from TrimRight, there is also TrimLeft (trim spaces from left side) and Trim (trim spaces from both sides): TrimLeft(' LoremIpsum') -> 'LoremIpsum' Trim(' LoremIpsum ') -> 'LoremIpsum' Just try to avoid using TrimLeft and TrimRight in combination like this: s := TrimLeft(TrimRight(' LoremIpsum ')); // or TrimRight(TrimLeft()) this is wasteful and unnecessary complicated. Just use Trim instead. Share this post Link to post