hanhphuc Posted July 15, 2020 Posted July 15, 2020 Stefan's RegEx idea (defun LostInSpace? ($) (while (eval (cons 'cond (mapcar '(lambda (x) (list (list 'vl-string-search (cdr x) '$) (list 'setq '$ (list 'vl-string-subst (car x) (cdr x) '$ ) ) ) ) '(( " " . " ") ( ". " . " .") ; $2. 00 ;( "." . " .") ; $2.00 ( ", " . " ,") ( " $" . "$ ") ( "-" . " - ")) ) ) ) ) (vl-string-trim " " $) ) (LostInSpace? " This is a double sentence ,the other one is not .This is a normal string . " ) "This is a double sentence, the other one is not. This is a normal string." (LostInSpace? " I spent $ 2 . 00 on ice - cream . ") "I spent $2. 00 on ice-cream." 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.