;;;Convert a number in (m)any text string(s) from meters to feet. ;;;Adds parenthesis around number. (uses UINT USTR) ;;;Specify or change precision (decimal places) too. ;;; ;;; AUTHOR: HENRY C. FRANCIS ;;; 425 N. ASHE ST. ;;; SOUTHERN PINES, NC 28387 ;;; ;;; All rights reserved without prejudice. ;;; ;;; Copyright: 9-19-95 ;;; Edited: 9-29-98 ;;; (DEFUN C:MTOI () (SETQ luprc (GETVAR "luprec")) (PRINC "\nConvert numeric text from Meters to Feet") (SETQ ndpl (uint 1 "" "Number of decimal places " ndpl)) (SETVAR "luprec" ndpl) (SETQ adjv 3.28083989501) (WHILE (SETQ tele (NENTSEL "\nSelect number to change ")) (SETQ elem (ENTGET (CAR tele))) (SETQ tstr (CDR (ASSOC 1 elem))) (SETQ cnt_1 1 cnt_2 1 ) ;_ end of setq (WHILE (AND (/= (SUBSTR tstr cnt_1 1) "0") (/= (SUBSTR tstr cnt_1 1) "1") (/= (SUBSTR tstr cnt_1 1) "2") (/= (SUBSTR tstr cnt_1 1) "3") (/= (SUBSTR tstr cnt_1 1) "4") (/= (SUBSTR tstr cnt_1 1) "5") (/= (SUBSTR tstr cnt_1 1) "6") (/= (SUBSTR tstr cnt_1 1) "7") (/= (SUBSTR tstr cnt_1 1) "8") (/= (SUBSTR tstr cnt_1 1) "9") (< cnt_1 (STRLEN tstr)) ) ;_ end of and (IF (WCMATCH (SUBSTR tstr cnt_1 5) "%%###") (SETQ cnt_1 (+ cnt_1 5)) (SETQ cnt_1 (1+ cnt_1)) ) ;_ end of if ) ;_ end of while (WHILE (OR (= (SUBSTR tstr (+ cnt_1 cnt_2) 1) "0") (= (SUBSTR tstr (+ cnt_1 cnt_2) 1) "1") (= (SUBSTR tstr (+ cnt_1 cnt_2) 1) "2") (= (SUBSTR tstr (+ cnt_1 cnt_2) 1) "3") (= (SUBSTR tstr (+ cnt_1 cnt_2) 1) "4") (= (SUBSTR tstr (+ cnt_1 cnt_2) 1) "5") (= (SUBSTR tstr (+ cnt_1 cnt_2) 1) "6") (= (SUBSTR tstr (+ cnt_1 cnt_2) 1) "7") (= (SUBSTR tstr (+ cnt_1 cnt_2) 1) "8") (= (SUBSTR tstr (+ cnt_1 cnt_2) 1) "9") (= (SUBSTR tstr (+ cnt_1 cnt_2) 1) ".") ) ;_ end of or (SETQ cnt_2 (1+ cnt_2)) ) ;_ end of while (IF (> cnt_1 1) (PROGN (SETQ pfx_str (SUBSTR tstr 1 (1- cnt_1))) (IF (>= (STRLEN tstr) (+ cnt_1 cnt_2)) (SETQ sfx_str (SUBSTR tstr (+ cnt_1 cnt_2))) (SETQ sfx_str "") ) ;_ end of if ) ;_ end of progn (PROGN (IF (>= (STRLEN tstr) (1+ cnt_2)) (SETQ sfx_str (SUBSTR tstr (1+ cnt_2))) (SETQ sfx_str "") ) ;_ end of if (SETQ pfx_str "") ) ;_ end of progn ) ;_ end of if (SETQ nstr (STRCAT pfx_str (IF (AND (EQ pfx_str "") (EQ sfx_str "")) (RTOS (* (DISTOF tstr 2) adjv) 2 ndpl) (RTOS (* (DISTOF (SUBSTR tstr cnt_1 cnt_2) 2) adjv) 2 ndpl) ) ;_ end of if sfx_str ) ;_ end of strcat ) ;_ end of setq (SETQ elem (SUBST (CONS 1 nstr) (ASSOC 1 elem) elem ) ;_ end of subst ) ;_ end of SETQ (ENTMOD elem) (ENTUPD (CDR (ASSOC -1 elem))) ) ;_ end of WHILE (SETVAR "luprec" luprc) (PRINC) ) ;_ end of DEFUN ;|«Visual LISP© Format Options» (72 2 40 2 T "end of " 60 9 2 0 0 T T nil T) ***Don't add text below the comment!***|;