Given an input string, generate a variable name out of it - MATLAB Cody - MATLAB Central

Problem 2216. Given an input string, generate a variable name out of it

Difficulty:Rate
Given an input string, generate a variable name out of it in easy to read format by a programmer.
If the input string contains any special character other than ('_'), replace it with ('_') and then return it in readable format variable name.
Example
input = 'this is an input var'
output = 'thisIsAnInputVar'
Another example
input = 'this one has special char @123'
output = 'thisOneHasSpecialChar_123'

Solution Stats

29.7% Correct | 70.3% Incorrect
Last Solution submitted on Jul 15, 2024

Problem Comments

Solution Comments

Show comments
Why should you share code?
In a discussion on LInkedin about my recent blog post, Do these...
2
3

Problem Recent Solvers29

Suggested Problems

More from this Author25

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!