Note that there are some explanatory texts on larger screens.

plurals
  1. POInput text file - swapping integers
    primarykey
    data
    text
    <p>I've a text file of integer data i.e.,</p> <blockquote> <p>00201305170013333<br> 01201305170013333<br> 02201305170013333</p> </blockquote> <p>I want to swap the 2nd and 3rd location of each line with its 6th and 7th index on each line. I applied the swap technique but somehow the new string is not getting updated.</p> <p>Look at the code:</p> <pre><code>Imports System Imports System.IO Imports System.Collections Module Module1 Sub Main() Dim reader As StreamReader = New StreamReader("input.txt") Dim sLine As String = "" Dim arrText As New ArrayList() Do sLine = reader.ReadLine() If Not sLine Is Nothing Then arrText.Add(sLine) End If Loop Until sLine Is Nothing reader.Close() Dim varReplace As Integer Dim arrTextToString(arrText.Count) As String For varReplace = 0 To arrText.Count - 1 arrTextToString(varReplace) = arrText(varReplace).ToString() Next Dim rep As Integer For rep = 0 To arrText.Count - 1 Dim two, three, mix1, mix2, six, seven As String Dim str = arrText(rep) two = (str(2)) three = (str(3)) six = (str(6)) seven = (str(7)) mix1 = two two = six six = mix1 mix2 = three three = seven seven = mix2 str(2) = two.ToString() str(3) = three.ToString() str(6) = six.ToString() str(7) = seven.ToString() Console.Write(two) Console.Write(three) Console.Write(" ") Console.Write(six) Console.Write(seven) Console.Write(" ") Console.WriteLine(str) Next 'For pri = 0 To arrText.Count - 1 'Console.WriteLine(arrTextToString(pri)) 'Next Console.ReadLine() End Sub End Module </code></pre>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

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