Wish IDE invert an equation

Marc De Loose

Member
Licensed User
A hotkey to invert an equation would have been handy a couple of times


lets say you have:

this.a = get.z
this.n = get.l
that.f = put.x

and you want to have this quickly:
get.z = this.a
get.l = this.n
put.x = that.f

a hotkey to swap that in a election would be awesome.

:)
 

MarkusR

Well-Known Member
Licensed User
long ago i thought about a assignment with direction
a => b copy a to b
a <= b copy b to a
or with a arrow
a -> b
a <- b
or as
a > b
a < b
or with an unicode char

or with a variable direction as parameter works at runtime
a d b
a d b
 

MarkusR

Well-Known Member
Licensed User
something to play with in b4j :)

Snap_2019.01.29_21h22m14s_001_.png

B4X:
#Region Project Attributes
    #MainFormWidth: 600
    #MainFormHeight: 600
#End Region

Sub Process_Globals
    Private fx As JFX
    Private MainForm As Form
    Private ButtonClipboard As Button
    Private TextArea1 As TextArea
    Private ButtonSwap As Button
    Private TextArea2 As TextArea
End Sub

Sub AppStart (Form1 As Form, Args() As String)
    MainForm = Form1
    MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
    MainForm.Show
End Sub

'Return true to allow the default exceptions handler to handle the uncaught exception.
Sub Application_Error (Error As Exception, StackTrace As String) As Boolean
    Return True
End Sub

Sub ButtonClipboard_Click

    TextArea1.Text = fx.Clipboard.GetString()
    
End Sub

Sub ButtonSwap_Click

    Dim LineBreak As String = CRLF  'Chr(13) & Chr(10)

    Dim Rows() As String
    Rows = Regex.Split(LineBreak, TextArea1.Text)
    TextArea2.Text = ""
    For Each Row As String In Rows
        If Row.Contains("=") Then
            Dim Components() As String
            Components = Regex.Split("=", Row)       
            TextArea2.Text = TextArea2.Text & Components(1) & "=" & Components(0) & LineBreak
        Else
            TextArea2.Text = TextArea2.Text & Row & LineBreak
        End If
            
    Next
    
    fx.Clipboard.SetString(TextArea2.Text)
    
End Sub
 
Top