Invert a string from a character

Asked

Viewed 68 times

1

I wanted a method to take a field on the side of a string and pass to the other side after the character '=', example:

  ColorPickerButton1.SelectedColor = My.Settings.getColorKeyword
  ColorPickerButton2.SelectedColor = My.Settings.getColorPreprocessor
  ColorPickerButton3.SelectedColor = My.Settings.getColorString
  ColorPickerButton4.SelectedColor = My.Settings.getColorNumber
  ColorPickerButton5.SelectedColor = My.Settings.getColorText
  ColorPickerButton6.SelectedColor = My.Settings.getColorBackground
  ColorPickerButton7.SelectedColor = My.Settings.getColorNumericCount
  ColorPickerButton8.SelectedColor = My.Settings.getColorIndent
  ColorPickerButton9.SelectedColor = My.Settings.getColorFoldingIndicator
  ColorPickerButton10.SelectedColor = My.Settings.getColorCaret

I wanted you to reverse what is being assigned to what is being received. Example with the first item:

  ColorPickerButton1.SelectedColor = My.Settings.getColorKeyword 'antigo
  My.Settings.getColorKeyword = ColorPickerButton1.SelectedColor 'novo

Any website, method, anything that does that? (I have about 50 lines to reverse, I didn’t want to do it manually).

  • 1

    I don’t know if there is any tool that does exactly that, but I decided to play and made one: https://alanmol.shinyapps.io/RevEqual

  • 1

    What language? Or is this something to be done once and done? If your text editor supports regular expressions in "find/replace", you just need to find ([^=]+)[=]([^\n]+)\n and replace with $2=$1\n. Example

  • What is this programming language? I seem to be VB, but there are other languages that could be, so the best would be if you clarified this.

  • VB.NET, I found an easy way here, in case select in column mode and send everything forward.

  • @Molx this tool was what I needed, thanks!

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.