Jump to content

help with string read and write


 Share

Recommended Posts

this is the line in a textfile

<ado$, arriba, cordoba, A$, A 8$, DATOS, co da no, kJe, ABC$, Ma do, Mitos, Prev_D_Trib_7.1, punto>

I need to write it into ini file reading the line until a "," is found, thene break the line and delete the space after the coma, and then read again, if there is a text with a $ in it it must be ignored

result must be

arriba

cordoba

DATOS

co da no

kJe

Ma do

Mitos

Prev_D_Trib_7.1

punto

text not wanted in file

ABC$

A$

A 8$

ado$

Edited by kimurtus
Link to comment
Share on other sites

Example:

$iniFile = "c:\your.ini"
$read = FileRead("c:\test.txt", FileGetSize("c:\test.txt"))
$splitStr = StringSplit($read, @LF)

For $i = 1 To $splitStr[0]
    If Not $splitStr[$i] = '' Then Parsing($splitStr[$i])
    Next

Func Parsing($rString)
    Local $sSplit = StringSplit($read, "," & @CR & @LF)
    For $i = 1 To $sSplit[0]
        If Not $sSplit[$i] = '' And Not StringInStr($sSplit[$i], "$") Then IniWrite($iniFile, "YourSection", $sSplit[$i], "1")
        Next
    EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...