:toCamelCase

converts a string to camel case

Description: call:toCamelCase str
Script:
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
:toCamelCase str -- converts a string to camel case
::               -- str [in,out] - valref of string variable to be converted
:$created 20080219 :$changed 20080219 :$categories StringManipulation
:$source https://www.dostips.com
if not defined %~1 EXIT /b
REM make all lower case
for %%a in ("A=a" "B=b" "C=c" "D=d" "E=e" "F=f" "G=g" "H=h" "I=i"
            "J=j" "K=k" "L=l" "M=m" "N=n" "O=o" "P=p" "Q=q" "R=r"
            "S=s" "T=t" "U=u" "V=v" "W=w" "X=x" "Y=y" "Z=z"
            "Ä=ä" "Ö=ö" "Ü=ü") do (
    call set "%~1=%%%~1:%%~a%%"
)
call set "%~1= %%%~1%%"
REM make first character upper case
for %%a in (" a=A" " b=B" " c=C" " d=D" " e=E" " f=F" " g=G" " h=H" " i=I"
            " j=J" " k=K" " l=L" " m=M" " n=N" " o=O" " p=P" " q=Q" " r=R"
            " s=S" " t=T" " u=U" " v=V" " w=W" " x=X" " y=Y" " z=Z"
            " ä=Ä" " ö=Ö" " ü=Ü") do (
    call set "%~1=%%%~1:%%~a%%"
)
call set "%~1=%%%~1: =%%"
EXIT /b