I want to convert a "title" which can have whitespaces in it like " this is a Test title "
to a string where all whitespaces are removed and the words which were previously separated by the whitspaces are all starting with capital letters.
The result of the above string should be "ThisIsATestTitle"
.
Goal is to create a string which then can be used as a folder name for the filesystem.
CodePudding user response:
In MsAccess VBA:
replace(strconv(" this is a Test title ",vbProperCase)," ","")
returns ThisIsATestTitle
Thanks @June7 for giving this useful info:
If expression in query or textbox, use 3 in place of vbProperCase.
CodePudding user response:
Goal is to create a string which then can be used as a folder name for the filesystem.
Then you have a few more things to do.
Non-trailing spaces are not a problem, but a lot of other characters are. In particular, you need to remove all occurences of <
, >
, :
, "
, /
, \
, |
, ?
and *
.
There are a few special edge cases as well: For example, you can't use any of the "reserved names" (COM1
etc.) and your name must not end with a period. For a full list, see Microsoft's official documentation: