Strip whitespace from a string/Top and tail
The task is to demonstrate how to strip leading and trailing whitespace from a string. The solution should demonstrate the following three results:
- String with leading whitespace removed
- String with trailing whitespace removed
- String with both leading and trailing whitespace removed
Template:QBasic
<lang qbasic> mystring$=ltrim(mystring$) ' remove leading whitespace
mystring$=rtrim(mystring$) ' remove trailing whitespace mystring$=ltrim(rtrim(mystring$)) ' remove both leading and trailing whitespace
</lang>