When I push cmd + alt + l
Webstorm doing some reformating to beautify my JavaScript sources. Ho to make Webstorm automatically change double quotes to single quotes in my sources?
Use the String. replace() method to replace double with single quotes, e.g. const replaced = str. replace(/"/g, "'"); . The replace method will return a new string where all occurrences of double quotes are replaced with single quotes.
To remove double quotes just from the beginning and end of the String, we can use a more specific regular expression: String result = input. replaceAll("^\"|\"$", ""); After executing this example, occurrences of double quotes at the beginning or at end of the String will be replaced by empty strings.
If the quotation enclosed in single marks also contains material–whether another quotation or the title of a work–that needs to be set off with quotation marks, use double quotation marks around that material. The pattern is double, single, double quotation marks.
In Webstorm 2017.1, do the following:
Use 'double' quotes
to Use 'single' quotes
. (Additionally, you can change 'in new code'
to 'always'
)If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With