Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>If we use an assumption that your line length is 80 characters, Limit the max length of your text line to 70 characters. If the actual length is less than 70 add the difference in spaces to the front of the map data you are wishing to add. This is also dependent on using a monospaced font.</p> <pre><code>Dim LineOfText As String = "This is a test text" Dim LineOfMap As String = "+------+" Dim newLine As String newLine = LineOfText &amp; LineOfMap.PadLeft(80 - LineOfText.Length) </code></pre> <p>edit: added arrays, used Courier New Font</p> <pre><code>Dim LineOfText(6) As String Dim LineOfMap(4) As String Public Sub CreateArray() LineOfMap(0) = "+-----+" LineOfMap(1) = "| # |" LineOfMap(2) = "|#-#-#|" LineOfMap(3) = "| # |" LineOfMap(4) = "+-----+" LineOfText(0) = " Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis tempus" LineOfText(1) = "orci diam. Curabitur hendrerit augue et lorem vulputate semper. Nullam" LineOfText(2) = "aliquam eleifend sapien nec bibendum. Donec accumsan leo eu orci" LineOfText(3) = "elementum semper in mollis metus. Ut ipsum diam, suscipit vel bibendum" LineOfText(4) = "non, congue eu nisi. Donec justo dolor, scelerisque nec fringilla nec," LineOfText(5) = "aliquet sit amet elit. Morbi elementum pharetra odio, nec accumsan" LineOfText(6) = "velit lacinia quis." Dim x As Integer For x = 0 To 4 LineOfText(x) = LineOfText(x) &amp; LineOfMap(x).PadLeft(80 - LineOfText(x).Length) &amp; vbCrLf Next For x = 0 To 6 Label1.Text = Label1.Text &amp; LineOfText(x) Next End Sub </code></pre> <p>Edit: You can create a function and grow the array if the number of lines is less than 5 to make sure you have space for the map.</p> <pre><code>Public Function CreateArray(text() As String, map() As String) as String() Dim x As Integer If text.Length &lt; map.Length Then For x = 0 To map.Count - 1 If x &lt; text.Count - 1 Then text(x) = text(x) &amp; map(x).PadLeft(80 - text(x).Length) &amp; vbCrLf Else Array.Resize(text, text.Count + 1) text(x) = map(x).PadLeft(80) &amp; vbCrLf End If Next Else For x = 0 To map.Count - 1 text(x) = text(x) &amp; map(x).PadLeft(80 - text(x).Length) &amp; vbCrLf Next End If return text End Sub </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload