Welcome,
Guest
. Please
login
or
register
.
1 Hour
1 Day
1 Week
1 Month
Forever
Login with username, password and session length
News:
Home
Help
Login
Register
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
If possible help with the conversion "13204.74087\\P16224.7943\\P2.56"
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: If possible help with the conversion "13204.74087\\P16224.7943\\P2.56" (Read 1913 times)
0 Members and 1 Guest are viewing this topic.
HOSNEYALAA
Newt
Posts: 106
If possible help with the conversion "13204.74087\\P16224.7943\\P2.56"
«
on:
August 27, 2019, 10:32:51 AM »
Hello all
If I have this sentence
"13204.74087\\P16224.7943\\P2.56"
How can i turn it into
(13204.74087 16224.7943 2.56)
Thanks in advance
Logged
ronjonp
Needs a day job
Posts: 7531
Re: If possible help with the conversion "13204.74087\\P16224.7943\\P2.56"
«
Reply #1 on:
August 27, 2019, 11:18:43 AM »
Something like this:
Code - Auto/Visual Lisp:
[Select]
(
read
(
strcat
"("
(
vl-string-translate
"
\\
P"
" "
"13204.74087
\\
P16224.7943
\\
P2.56"
)
")"
)
)
Or do a search for 'parse string' .. there are numerous examples.
Probably most used:
http://www.lee-mac.com/stringtolist.html
«
Last Edit: August 27, 2019, 11:51:56 AM by ronjonp
»
Logged
Windows 11 x64 - AutoCAD /C3D 2023
Custom Build PC
Tharwat
Swamp Rat
Posts: 710
Hypersensitive
WWW
Re: If possible help with the conversion "13204.74087\\P16224.7943\\P2.56"
«
Reply #2 on:
August 27, 2019, 11:25:34 AM »
Hi,
Your string must have been retrieved from Mtext object.
so you can use the following function:
Code - Auto/Visual Lisp:
[Select]
(
defun
_peelstring
(
string del
/
str pos lst
)
;; Tharwat - date: 07.Nov.2015 ;;
(
while
(
setq
pos
(
vl-string-search
del string
0
)
)
(
setq
str
(
substr
string
1
pos
)
string
(
substr
string
(
+
pos
(
1+
(
strlen
del
)
)
)
)
)
(
and
str
(
/=
str
""
)
(
setq
lst
(
cons
str lst
)
)
)
)
(
and
string
(
/=
string
""
)
(
setq
lst
(
cons
string lst
)
)
)
(
reverse
lst
)
)
The return would be in a string format:
Code - Auto/Visual Lisp:
[Select]
(
_peelstring
"13204.74087
\\
P16224.7943
\\
P2.56"
"
\\
P"
)
Logged
HVAC, Plumbing, Drainage, Electricity , Fire Fighting Programs and many more .....
HOSNEYALAA
Newt
Posts: 106
Re: If possible help with the conversion "13204.74087\\P16224.7943\\P2.56"
«
Reply #3 on:
August 28, 2019, 01:57:23 AM »
Thank you so much
ronjonp
Tharwat
The solution is good
And it works great
Thank you
Logged
Tharwat
Swamp Rat
Posts: 710
Hypersensitive
WWW
Re: If possible help with the conversion "13204.74087\\P16224.7943\\P2.56"
«
Reply #4 on:
August 28, 2019, 04:58:28 AM »
You're welcome anytime.
Logged
HVAC, Plumbing, Drainage, Electricity , Fire Fighting Programs and many more .....
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
Code Red
»
AutoLISP (Vanilla / Visual)
»
Topic:
If possible help with the conversion "13204.74087\\P16224.7943\\P2.56"