Delphi: Trim, TrimLeft and TrimRight - Cut off whitespace from a string
Info by Delphian | 2012-10-04 at 14:49
Cutting off white space such as blanks, tabs and line breaks from the front and the rear of a string is an easy task in Delphi and Lazarus. Delphi and Lazarus are providing the functions Trim, TrimLeft and TrimRight for this. Let's have a look at an example:
var str, str1, str2, str3: string; begin str := ' ABC '; str1 := Trim(str); // "ABC" str2 := TrimLeft(str); // "ABC " str3 := TrimRight(str); // " ABC" end;
We are processing the string " ABC " by using Trim, TrimLeft and TrimRight. Trim is cutting the spaces at the front and the rear of the string. TrimLeft and TrimRight are cutting the white space only at the left or the right side.
About the Author
The author has not added a profile short description yet.
Show Profile
Related Topics
PHP: Remove arbitrary Characters at the Beginning and the End of a String
Tutorial | 0 Comments
How to Replace multiple Texts at the same Time
Tutorial | 0 Comments
PHP: Check Strings with Ctype-Functions for Character Classes
Article | 0 Comments
PHP: Remove all empty elements from string array
Tip | 0 Comments
Remove Spaces from the Beginning and End of the Lines of Texts
Tutorial | 0 Comments
CSS: Display Spaces and Paragraphs as in the HTML Code
Tip | 0 Comments
HTML: No line break between particular words
Tip | 0 Comments
Important Note
Please note: The contributions published on askingbox.com are contributions of users and should not substitute professional advice. They are not verified by independents and do not necessarily reflect the opinion of askingbox.com. Learn more.
Participate
Ask your own question or write your own article on askingbox.com. That’s how it’s done.