split camelCase or PascalCase filenames.

Javascript renaming examples. Javascript renaming is supported in version 3 or newer.

split camelCase or PascalCase filenames.

Postby Parduz » Mon May 15, 2017 4:02 pm

I have a lot of files with names in camelCase or PascalCase. I want to separate uppercase chars with a space... as example:
"ThisIsASample.txt" become "This Is A Sample.txt"
"ThisIsSampleB.txt" becomes "This Is Sample B.txt"....

How could it be done?
Parduz
 
Posts: 2
Joined: Mon May 15, 2017 2:17 pm

Re: split camelCase or PascalCase filenames.

Postby Admin » Tue May 16, 2017 1:29 am

Try

Code: Select all
newName = name.replace(/([A-Z])/g, ' $1').trim();


In Javascript
Admin
Site Admin
 
Posts: 1522
Joined: Tue Mar 08, 2005 8:39 pm


Return to Javascript Renaming