明经CAD社区

 找回密码
 注册

QQ登录

只需一步,快速开始

搜索
查看: 1448|回复: 2

如何简单提取字符串中"实型"子字符串

[复制链接]
发表于 2005-7-11 12:07:00 | 显示全部楼层 |阅读模式

例:

"dfafd19393.4959djfkdjf384834.56dfh"

=>"19393.4959","384834.56"

发表于 2005-7-11 13:44:00 | 显示全部楼层
;试用以下程序
;Command: (sszh "dfafd19393.4959djfkdjf384834.56dfh")
;("19393.4959" "384834.56")
(defun sszh(xzfc /  sz zfc fhb)
    (setq sz '(43 45 46 48 49 50 51 52 53 54 55 56 57 58)
          zfc "" fhb nil
    )
    (mapcar '(lambda(x)
         (if (member x sz)
      (setq zfc (strcat zfc (chr x)))
      (if (not (member zfc fhb))
          (setq fhb (append fhb (list zfc)) zfc "")
      )
  )
       )
       (vl-string->list xzfc)
    )
    (vl-remove "" fhb)     
)
发表于 2005-7-11 14:13:00 | 显示全部楼层
;;(str2real "dfafd19393.4959djfkdjf384834.56dfh")
(DEFUN str2real (str / hold)
  (SETQ hold (VL-STRING->LIST "0123456789."))
  (READ (STRCAT "("
                (VL-LIST->STRING (MAPCAR '(LAMBDA (_tmp)
                                            (IF (MEMBER _tmp hold)
                                              _tmp
                                              32
                                            )
                                          )
                                         (VL-STRING->LIST str)
                                 )
                )
                ")"
        )
  )
)
您需要登录后才可以回帖 登录 | 注册

本版积分规则

小黑屋|手机版|CAD论坛|CAD教程|CAD下载|联系我们|关于明经|明经通道 ( 粤ICP备05003914号 )  
©2000-2023 明经通道 版权所有 本站代码,在未取得本站及作者授权的情况下,不得用于商业用途

GMT+8, 2024-11-17 17:23 , Processed in 0.163831 second(s), 26 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表