({{, (RefLink[StringTrim, paclet:ref/StringTrim])["string"] 
trims whitespace from the beginning and end of "string".}, {, (RefLink[StringTrim, paclet:ref/StringTrim])["string",patt]
trims substrings matching patt from the beginning and end.}})

OpenersNotesSection(Spacer1)Details and Options

Whitespace is taken to include any number of spaces, tabs, and newlines.

(RefLink[StringTrim, paclet:ref/StringTrim])[{(Subscript[s, 1]),(Subscript[s, 2]),…},…] gives the list of results for each of the (Subscript[s, i]).

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (3)

Remove whitespace from ends of strings:

StringTrim["   aaa bbb ccc   "]//FullForm

Remove multiple character types:

StringTrim["++++aaa bbb ccc----",("+"|"-")...]//FullForm

Remove initial space characters using a regular expression pattern:

StringTrim["   aaa bbb ccc   ",RegularExpression["^ *"]]//FullForm

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[StringReplace, paclet:ref/StringReplace])  ▪  (RefLink[StringDrop, paclet:ref/StringDrop])  ▪  (RefLink[StringSplit, paclet:ref/StringSplit])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[String Operations, paclet:guide/StringOperations])}, {▪(RefLinkPlain[Text Normalization, paclet:guide/TextNormalization])}, {▪(RefLinkPlain[Text Manipulation, paclet:guide/ProcessingTextualData])}})}})