barristann Posted June 3, 2023 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
Tharwat Posted June 3, 2023 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
Steven P Posted June 4, 2023 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
barristann Posted June 4, 2023 Author Posted June 4, 2023 Thank you everyone for your guidance. 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.