Android Question List and array's

Discussion in 'Android Questions' started by G-ShadoW, Jun 5, 2015.

  1. G-ShadoW

    G-ShadoW Active Member Licensed User

    Hello,

    how to replace position in all lines

    example:
    yyyyy;xxxxx;1;0;0;0

    I need to replace y and x to look like this

    xxxxx;yyyyy;1;0 last 2 value's delete
     
  2. DonManfred

    DonManfred Expert Licensed User

    read the lines
    for each lines....
    get line x
    split it with regex into the parts
    create the line new
    write the new line
    next

    write back all lines
     
  3. G-ShadoW

    G-ShadoW Active Member Licensed User

    Code:
    For i=0 To MyList.Size-1
          
    Dim MyLine As String =MyList.Get(i)
         
            
    Dim arrLine() As String = Regex.Split(",",MyLine)
       
         
        
    Next
    how to get x ?
     
  4. G-ShadoW

    G-ShadoW Active Member Licensed User

    Code:
    Dim x As String
       
    Dim y As String

       
    For i=0 To MyList.Size-1
        
    Dim MyLine As String =MyList.Get(i)
      
        
    Dim arrLine() As String = Regex.Split(",",MyLine)
        x = arrLine(
    1)
         y= arrLine(
    0)
        
    Log("X line: " & x)
         
    Log("Y line: " & y)
       
    Next
      
    Log(MyLine)
    End Sub
    how to save it back ?
     
  5. G-ShadoW

    G-ShadoW Active Member Licensed User

    Ok, thanx I get it...
     
  6. G-ShadoW

    G-ShadoW Active Member Licensed User

    uppsss, I get error on saving ?

    Code:
    Dim x As String
        
    Dim y As String
        
    Dim b As String
      
      
        
    For i=0 To MyList.Size-1
          
    Dim MyLine As String =MyList.Get(i)
        
            
    Dim arrLine() As String = Regex.Split(",",MyLine)
            x = arrLine(
    1)
            y = arrLine(
    0)
            b = arrLine(
    3)
            ListView1.AddSingleLine(x & 
    ";" & y & ";" & b)
        
    Next
    File.WriteList(File.DirRootExternal , "/cr/au.txt", ListView1)
     
  7. G-ShadoW

    G-ShadoW Active Member Licensed User

    This works now

    Code:
    Dim x As String
        
    Dim y As String
        
    Dim b As String
        
    Dim d As String
        
    For i=0 To MyList.Size-1
          
    Dim MyLine As String =MyList.Get(i)
        
            
    Dim arrLine() As String = Regex.Split(",",MyLine)
            x = arrLine(
    1)
            y = arrLine(
    0)
            b = arrLine(
    3)
            d= x & 
    ";" & y & ";" & b
            ListView1.AddSingleLine(x & 
    ";" & y & ";" & b)
        myline2.Add(d)
        
    Next
    File.Writelist(File.DirRootExternal , "/cr/au.txt", myline2)
     
  8. RandomCoder

    RandomCoder Well-Known Member Licensed User

    Nice one Shadow, glad your finding your feet. Don't forget the power of the Log command when trying to debug code, i.e .
    Code:
    Log("(0)= " & arrLine(0) & " (1)= " & arrLine(1))
    To see what values you actually have when connected in debug mode.
     
    DonManfred likes this.
Loading...
  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice