barristann Posted June 3, 2023 Share Posted June 3, 2023 (edited) Is it possible to split 1 text into 2 separate texts, based on character "-"? For example, can I split VAR-259 into VAR -259 Thank you all. Edited June 3, 2023 by barristann Quote Link to comment Share on other sites More sharing options...
ronjonp Posted June 3, 2023 Share Posted June 3, 2023 http://www.lee-mac.com/stringtolist.html 2 Quote Link to comment Share on other sites More sharing options...
Tharwat Posted June 3, 2023 Share Posted June 3, 2023 As simple as follows: (setq str "VAR-259") (and (setq pos (vl-string-search "-" str)) (setq pre (substr str 1 pos)) ;; = VAR (setq suf (substr str (+ pos 2))) ;; = 259 ) 1 Quote Link to comment Share on other sites More sharing options...
Steven P Posted June 4, 2023 Share Posted June 4, 2023 I'd go string to List, splits at every character '-' and you can make up the texts to suit from that 1 Quote Link to comment Share on other sites More sharing options...
barristann Posted June 4, 2023 Author Share Posted June 4, 2023 Thank you everyone for your guidance. Quote Link to comment Share on other sites More sharing options...
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.