Considering we have few strings:
s1 = "dasbdk "
s2 = "asdnkal asn knkl nkn dvklsn "
s3 = " jbjkbasd nklnkln "
Q1:
How can the blank-spaces in the end only be trimmed out to have the following result:
s1 = "dasbdk"
s2 = "asdnkal asn knkl nkn dvklsn"
s3 = " jbjkbasd nklnkln"
Q2
How can any 2-or-more sequence of blank-spaces be trimmed out to have the following result:
s1 = "dasbdk"
s2 = "asdnkal asn knkl nkn dvklsn"
s3 = "jbjkbasd nklnkln"
Thanks!
StringTrim[]
? $\endgroup$StringTrim
can take a second argument to target any pattern, and so can do Q1 and Q2. $\endgroup$