I would like to convert the first uppercased letter in a VSCode Dart snippet to a lowercased one.
Example:
MyClassIWroteInMySnippet -> myClassIWroteInMySnippet
During my search, I found this which demonstrate how to convert a camelCase String to UPPER_CASED_STRING but I don't achieve to pick the first character (in uppercase) and then transform it to lowercase...
Any help would be very appreciated !
Thanks :)
EDIT:
Here is my current snippet
"Mock a service using Mockito": {
"prefix": "testMockitoService",
"body": [
"class _${1}Mock extends Mock implements ${1} {}",
"",
"final ${1} = _${1}Mock();", // Here I want to "${1}" be camelCased when I finish to write my class
],
"description": "Mock a service using Mockito"
},
So If I insert my snippet, and write "MyClass", I want to display in my code
class _MyClassMock extends Mock implements MyClass {}
final myClass = _MyClassMock();
After your clarification in the question, try this:
${1/(.)(.*)/${1:/downcase}$2/}
puts the first letter into capture group 1 and the rest into capture group 2. Then that first letter is down-cased and the second group appended to that.