一千萬個為什麽

搜索

如何在操作員之前和之後放置空間以增強可讀性?

我想要 -

  • variable++; then variable ++;
  • variable1 + variable2 nothing to do
  • variable1 +variable2 then variable1 + variable2
  • variable1+ variable2 then variable1 + variable2
  • variable1+variable2 then variable1 + variable2

similarly for -,*,/,>=,<=,!=,==.
And if -

  • variable1 = variable2 then nothing to do
  • variable1 =variable2 then variable1 = variable2
  • variable1= variable2 then variable1 = variable2
  • variable1=variable2 then variable1 = variable2

I try the search regex as [a-zA-Z]+([-+/*=]|>=|<=|!=|==) although it is not correct fully.

最佳答案