简体   繁体   English

VB.net Java代码生成放置不需要的空间

[英]VB.net Java Code Gen Placing unwanted Space

Hello Im Trying To make A VB.net application to make me some java code for a plugin i am making this is the code the vb.net application has 您好我正在尝试制作一个VB.net应用程序,使我得到一些用于插件的Java代码,我正在制作这是vb.net应用程序具有的代码

Public Class Form1


    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        Dim s As String = ""
        Dim i As Integer = 0
        Dim X As Integer = Int(TextBox2.Text)
        Dim Z As Integer = Int(TextBox3.Text)
        Dim YDif As Integer = Int(TextBox4.Text)
        Dim YStart As Integer = Int(TextBox5.Text)
        Dim World As String = TextBox6.Text
        Dim Building As String = TextBox1.Text
        Dim Y As Integer = 0
        'Diff * Floor + Start
        '6 * 0 + start
        Do Until i = NumericUpDown1.Value
            Y = (YDif * i) + YStart
            s = s + "LiftHandeler.Buildings.put(loc(""" + World + """," + Str(X) + "," + Str(Y) + "," + Str(Z) + "), """ + Building + """);" + vbNewLine
            i = i + 1
        Loop
        i = 0
        Do Until i = NumericUpDown1.Value
            Y = (YDif * i) + YStart
            s = s + "LiftHandeler.Floors.put(""" + Building + Str(i + 1) + """,loc(""" + World + """," + Str(X) + "," + Str(Y) + "," + Str(Z) + "));" + vbNewLine
            i = i + 1
        Loop

        s = s + "LiftHandeler.FloorsAmt.put(""" + Building + """, " + Str(NumericUpDown1.Value) + ");"

        My.Computer.Clipboard.SetText(s)
    End Sub
End Class

The Output Should Be 输出应为

LiftHandeler.Buildings.put(loc("world", 43, 22, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 26, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 30, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 34, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 38, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 42, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 46, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 50, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 54, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 58, 971), "Andrew");
LiftHandeler.Floors.put("Andrew1",loc("world", 43, 22, 971));
LiftHandeler.Floors.put("Andrew2",loc("world", 43, 26, 971));
LiftHandeler.Floors.put("Andrew3",loc("world", 43, 30, 971));
LiftHandeler.Floors.put("Andrew4",loc("world", 43, 34, 971));
LiftHandeler.Floors.put("Andrew5",loc("world", 43, 38, 971));
LiftHandeler.Floors.put("Andrew6",loc("world", 43, 42, 971));
LiftHandeler.Floors.put("Andrew7",loc("world", 43, 46, 971));
LiftHandeler.Floors.put("Andrew8",loc("world", 43, 50, 971));
LiftHandeler.Floors.put("Andrew9",loc("world", 43, 54, 971));
LiftHandeler.Floors.put("Andrew10",loc("world", 43, 58, 971));
LiftHandeler.FloorsAmt.put("Andrew",  10);

But The Code output it is making is 但是它正在生成的代码输出是

LiftHandeler.Buildings.put(loc("world", 43, 22, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 26, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 30, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 34, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 38, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 42, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 46, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 50, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 54, 971), "Andrew");
LiftHandeler.Buildings.put(loc("world", 43, 58, 971), "Andrew");
LiftHandeler.Floors.put("Andrew 1",loc("world", 43, 22, 971));
LiftHandeler.Floors.put("Andrew 2",loc("world", 43, 26, 971));
LiftHandeler.Floors.put("Andrew 3",loc("world", 43, 30, 971));
LiftHandeler.Floors.put("Andrew 4",loc("world", 43, 34, 971));
LiftHandeler.Floors.put("Andrew 5",loc("world", 43, 38, 971));
LiftHandeler.Floors.put("Andrew 6",loc("world", 43, 42, 971));
LiftHandeler.Floors.put("Andrew 7",loc("world", 43, 46, 971));
LiftHandeler.Floors.put("Andrew 8",loc("world", 43, 50, 971));
LiftHandeler.Floors.put("Andrew 9",loc("world", 43, 54, 971));
LiftHandeler.Floors.put("Andrew 10",loc("world", 43, 58, 971));
LiftHandeler.FloorsAmt.put("Andrew",  10);

notice the unwanted Space After the Building Name (Andrew) And The Floor number on all the Floors.put Tags 在所有楼层上注意建筑物名称(Andrew)和楼层编号之后的多余空间。

Fixed the issue by replacing 通过替换来解决此问题

 s = s + "LiftHandeler.Floors.put(""" + Building + Str(i + 1) + """,loc(""" + World + """," + Str(X) + "," + Str(Y) + "," + Str(Z) + "));" + vbNewLine

With

 s = s + "LiftHandeler.Floors.put(""" + Building + "" + Str(i + 1).Replace(" ", "") + """,loc(""" + World + """," + Str(X) + "," + Str(Y) + "," +Str(Z) + "));" + vbNewLine

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM