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
»
CAD Forums
»
CAD General
»
Topic:
Is there a way to change a bunch of strings at one time?
« previous
next »
Print
Pages: [
1
] |
Go Down
Author
Topic: Is there a way to change a bunch of strings at one time? (Read 2012 times)
0 Members and 1 Guest are viewing this topic.
HasanCAD
Swamp Rat
Posts: 1422
Is there a way to change a bunch of strings at one time?
«
on:
October 16, 2014, 03:20:20 AM »
For example
C1 > C12
C5 > C62
TOP > BOTT
...
AND SO ON
Logged
Sorry for my English.
Donate to Theswamp
www.sergiwa.com
HasanCAD
Swamp Rat
Posts: 1422
Re: Is there a way to change a bunch of strings at one time?
«
Reply #1 on:
October 16, 2014, 03:55:35 AM »
I got it
Thanks LEE
http://www.lee-mac.com/bfind.html
Logged
Sorry for my English.
Donate to Theswamp
www.sergiwa.com
Kerry
Mesozoic relic
Seagull
Posts: 11654
class keyThumper<T>:ILazy<T>
Re: Is there a way to change a bunch of strings at one time?
«
Reply #2 on:
October 16, 2014, 03:59:42 AM »
Will the search string be the complete target string or will it be contained in the target string ( a substring ) ?
Will the search string and replacement string be string values or variables ?
The first thing you could do is build a reference list for your translations
I'll make some assumptions about your intent.
Code - Auto/Visual Lisp:
[Select]
(
setq
translationList
(
list
(
list
"C1"
"C12"
)
(
list
"C5"
"C62"
)
(
list
"TOP"
"BTM"
)
(
list
"SO"
"ON"
)
)
)
(
defun
getRef
(
key
)
(
cdr
(
assoc
key translationList
)
)
)
;; Test the function just to be sure
(
getRef
"CAT"
)
;;==> nil
(
getref
"TOP"
)
;;==> ("BTM")
(
car
(
getRef
"CAT"
)
)
;;==> nil
(
car
(
getRef
"C1"
)
)
;;==> "C12"
;; Now write a tester
(
setq
targetString
"C5"
)
(
if
(
setq
replacement
(
car
(
getRef targetString
)
)
)
(
setq
targetString replacement
)
)
(
alert
(
strcat
"targetString value is now
\n
"
targetString
)
)
Logged
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.
HasanCAD
Swamp Rat
Posts: 1422
Re: Is there a way to change a bunch of strings at one time?
«
Reply #3 on:
October 18, 2014, 04:15:00 AM »
While start to write a lisp, comes in mind it is very hard to do.
But when Kerry reply the post comes in mind the teacher while teaching me the lesson step by step.
Thanks Kerry for your very simple and easy way.
Logged
Sorry for my English.
Donate to Theswamp
www.sergiwa.com
Kerry
Mesozoic relic
Seagull
Posts: 11654
class keyThumper<T>:ILazy<T>
Re: Is there a way to change a bunch of strings at one time?
«
Reply #4 on:
October 18, 2014, 04:21:06 AM »
Thanks HasanCAD.
I teach the same way my brain usually works ... in little steps
and I do try very hard to keep stuff simple.
Logged
kdub, kdub_nz in other timelines.
Perfection is not optional.
Everything will work just as you expect it to, unless your expectations are incorrect.
Discipline: None at all.
Print
Pages: [
1
] |
Go Up
« previous
next »
TheSwamp
»
CAD Forums
»
CAD General
»
Topic:
Is there a way to change a bunch of strings at one time?