N = nelson.lang.makeValidName(S)
N = nelson.lang.makeValidName(S, 'ReplacementStyle', style)
N = nelson.lang.makeValidName(S, 'Prefix', prefix)
[N, modified] = nelson.lang.makeValidName(...)
| Parameter | Description |
|---|---|
| S | string array, character vector, or cell array of character vectors. |
| style | replacement style: 'underscore', 'delete', or 'hex'. |
| prefix | valid variable name used when a generated name does not start with a letter. |
| Parameter | Description |
|---|---|
| N | valid names, returned with the same text container type as S. |
| modified | logical array indicating which input elements were changed. |
nelson.lang.makeValidName removes whitespace, replaces unsupported characters, adds a prefix when needed, and truncates names to namelengthmax.
names = nelson.lang.makeValidName({'a b', 'a-b', '1a'})
[names, modified] = nelson.lang.makeValidName("a#b", 'ReplacementStyle', 'hex')
| Version | Description |
|---|---|
| 2.0.0 | initial version |