- string trim string ?chars?
See also:
The trimleft will remove the pathname from the beginning of the string and trimright will remove the extension. Remember that this command will not save to a variable, therefore you must set the same or another variable:
- TIP #318
: Extend Default Whitespace in 'string trim' Beyond ASCII
The trimleft will remove the pathname from the beginning of the string and trimright will remove the extension. Remember that this command will not save to a variable, therefore you must set the same or another variable:
% set foo ../returned../ ../returned../ % string trim $foo ./ returned % set foo ../returned../ % set foo [string trim $foo ./] returned % set foo returnedMG While you can use it for filenames, the file command is designed specifically for working with filenames and paths. A more general use is to remove leading/trailing white space from a string, something like...
(Griffiths) 9 % set foo {
> this is a test string }
this is a test string
(Griffiths) 10 % string trim $foo
this is a test stringSee also edit
- string
- string trimleft
- string trimright
- string map replaces substrings in a string (felipel)
