DuanJinHui Posted September 24, 2015 Share Posted September 24, 2015 "00ABCD12"==> "ABCD12" "0000abcd0123"===>"abcd0123" I use "vl-string-left-trim" function . (vl-string-left-trim "00" "00ABCD12") ==> "ABCD12" But sometimes ,I don't know how many " 0 " at the left side. Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 24, 2015 Share Posted September 24, 2015 Try this: (setq st "0000abcd012300") (while (eq (substr st 1 1) "0") (setq st (substr st 2)) ) Quote Link to comment Share on other sites More sharing options...
Lee Mac Posted September 24, 2015 Share Posted September 24, 2015 (vl-string-left-trim "0" "00ABCD12") Or: (vl-list->string (vl-member-if '(lambda ( x ) (/= 48 x)) (vl-string->list "00ABCD12"))) Quote Link to comment Share on other sites More sharing options...
DuanJinHui Posted September 24, 2015 Author Share Posted September 24, 2015 Try this: (setq st "0000abcd012300") (while (eq (substr st 1 1) "0") (setq st (substr st 2)) ) Thanks , Tharwat. Quote Link to comment Share on other sites More sharing options...
DuanJinHui Posted September 24, 2015 Author Share Posted September 24, 2015 (vl-string-left-trim "0" "00ABCD12") Or: (vl-list->string (vl-member-if '(lambda ( x ) (/= 48 x)) (vl-string->list "00ABCD12"))) Thanks, Lee . Quote Link to comment Share on other sites More sharing options...
Tharwat Posted September 24, 2015 Share Posted September 24, 2015 Thanks , Tharwat. You're welcome. 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.