({{, (RefLink[EndOfString, paclet:ref/EndOfString]) 
represents the end of a string for purposes of matching in (RefLink[StringExpression, paclet:ref/StringExpression]).}})

OpenersPrimaryExamplesSection(Spacer1)Examples  (3)

OpenersExampleSection0(Spacer1)Basic Examples  (1)

Test whether a string ends with a "t":

StringMatchQ["abaababbat",___~~"t"~~EndOfString]

OpenersExampleSection1(Spacer1)Scope  (1)

Replace the last letter in a string:

StringReplace["ababbabbaaaCb", LetterCharacter ~~EndOfString -> "t"]

OpenersExampleSection3(Spacer1)Applications  (1)

Remove the trailing spaces:

StringReplace["  Have a nice day.  ",(Whitespace ~~ EndOfString) ->  ""]//FullForm

({{DocumentationFooterIconsRelatedFunction.png, ({{See Also}, {(RefLink[StartOfString, paclet:ref/StartOfString])  ▪  (RefLink[EndOfLine, paclet:ref/EndOfLine])  ▪  (RefLink[StringExpression, paclet:ref/StringExpression])  ▪  (RefLink[StringEndsQ, paclet:ref/StringEndsQ])}})}})

({{DocumentationFooterIconsRelatedTutorial.png, ({{Tutorials}, {▪(RefLinkPlain[String Patterns, paclet:tutorial/StringPatterns])}, {▪(RefLinkPlain[Working with String Patterns, paclet:tutorial/WorkingWithStringPatternsOverview])}})}})

({{DocumentationFooterIconsRelatedGuide.png, ({{Related Guides}, {▪(RefLinkPlain[String Patterns, paclet:guide/StringPatterns])}})}})

({{(Spacer1), ({{(Spacer1)Related Links}, {(WebLink[DocumentationFooterIconsRelatedLinks-EIWL.png(Spacer1)An Elementary Introduction to the Wolfram Language, https://www.wolfram.com/language/elementary-introduction/42-string-patterns-and-templates.html])(WebLink[: String Patterns and Templates , https://www.wolfram.com/language/elementary-introduction/42-string-patterns-and-templates.html])}})}})