Skip to content

Convert a string array of snake case to camel/pascal case and vice versa.

License

Notifications You must be signed in to change notification settings

NewGuy012/convert-naming-convention

Repository files navigation

View spider_plot on File Exchange

Convert Naming Convention

Convert from snake case to camel/pascal case and vice versa.

Snake Case to Camel/Pascal Case

Syntax:

  • [camelCase, PascalCase] = snake2camel(snake_case)
  • snake_case = camel2snake(camelCase)

Input Arguments:

  • snake_case - Input text in snake case. [string array | character vector | cell array of character vectors]
  • camelCase - Input text in camel case. [string array | character vector | cell array of character vectors]

Examples:

% Example 1: Convert from snake case to camel/pascal case 
snake_case = ["num_files", "variable_name", "some_function"];
[camelCase, PascalCase] = snake2camel(snake_case);

% Example 2: Convert from camel case to snake case
camelCase = ["nFiles", "VariableName", "someFunction"];
snake_case = camel2snake(camelCase);

Author:

  • Moses Yoo, (juyoung.m.yoo at gmail dot com)

Special Thanks

Special thanks to Stephen for showing and explaining the much simpler regular expression version!

View spider_plot on File Exchange

About

Convert a string array of snake case to camel/pascal case and vice versa.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages