Mountain_XD Posted November 29, 2023 Posted November 29, 2023 Hi, I want to keep 9 characters from a string (DText or MText). Thank you so much ! Quote
Tharwat Posted November 29, 2023 Posted November 29, 2023 Here is an example: (setq str "B1-X-(300x200)") (if (> (setq len (strlen str)) 8) (substr str (- len 8)) ) 1 Quote
Steven P Posted November 29, 2023 Posted November 29, 2023 A slightly different way, if all the texts are in the format "ABC (NxY)" and where the numbers could be any length. Returns anything after the first '(' MyString is the text string to change (if (setq MyPos (vl-string-search "(" MyString)) ; position of deliminator, ( (setq MyString (substr MyString (+ MyPos 1)) ) ; if contains "(" MyString ; If doesn't contain "(" ) 2 Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.