any way to make a string "name safe"?

any way given a string to turn it into something that can become an operator name?

Since I’m letting the user type in a name in a field - and anything goes (( ):;"?> etc etc) - just changing spaces into underscores is not enough.

any suggestions?

thanks,
dani

Hey Dani,

there is a easy solution to it since the datto CHOP takes care of most of the characters you just have to convert the input text into a chop and then substitute “:” for “_”

see attached example.

cheers
markus
field.tox (934 Bytes)

sorry, forgot that channel names can contain “/”, so you would have to take care of this as well by doubling the substitute expression to

`substitute(substitute(chopname("datto1",0),":","_"),"/","_")`

markus

and “-”

what happens if you use opname command with the possibly unsupported characters? If it automatically replaces all unsupported characters with underscores, then you can use the -v (maybe with -a) flag to get the new name

hm - “-” as well… so 3 substitutes… proper pattern matching would make things very easy…

markus

I think I’d like to propose an RFE opnamesafe(“$string”)

I’ll implement the above suggestions, but it looks like one of those things that - as UI development grows, should just be there for developers to use when users specify names in fields.

It’s kind of a classic

d