Jump to content

how to put a characher after every line in a txt file (easy)


Arclite86
 Share

Recommended Posts

i have a autoit program that opens a txt file

Global $iIndex = 0, $sListData1 = "C:\Users\user pc\Desktop\mapa\lijsten\list1.txt"
Global $sListFile1 = "C:\Users\user pc\Desktop\mapa\lijsten\list1.txt"



If FileExists($sListFile1) Then
    $sListData1 = FileRead($sListFile1)
EndIf


GUICtrlSetData($List1, $sListData1)
_GUICtrlListBox_SetCurSel($List1, $iIndex)

the only problem is when I open the txt file there is no "|" charachter between the words so it only shows  a very long one word.

Link to comment
Share on other sites

Can you provide an example of what is in list1.txt?

A bunch of names for my administration like:

HelmerTilmans
MozesSchrijver
MelwinWilschut
PercyvanZwien
RoelfFolkersma
MarcelodeKeizer
EvanderPiet
JanvanKlavere
AadHorsthuis
EwoutRosenboom
RudiLebens
Dimitrioszwaag
Matejvanderziel
etc..

and this is what i would like to have it

HelmerTilmans|
MozesSchrijver|
MelwinWilschut|
PercyvanZwien|
RoelfFolkersma|
MarcelodeKeizer|
EvanderPiet|
JanvanKlavere|
AadHorsthuis|
EwoutRosenbom|
RudiLebens|
Dimitrioszwaag|
Matejvanderziel|
etc..

or before every name

Link to comment
Share on other sites

$sFile = fileread("test.txt")
$sRepl = StringReplace($sFile , @CRLF , "|" & @CRLF)
filewrite("output.txt" , $sRepl)

 

,-. .--. ________ .-. .-. ,---. ,-. .-. .-. .-.
|(| / /\ \ |\ /| |__ __||| | | || .-' | |/ / \ \_/ )/
(_) / /__\ \ |(\ / | )| | | `-' | | `-. | | / __ \ (_)
| | | __ | (_)\/ | (_) | | .-. | | .-' | | \ |__| ) (
| | | | |)| | \ / | | | | | |)| | `--. | |) \ | |
`-' |_| (_) | |\/| | `-' /( (_)/( __.' |((_)-' /(_|
'-' '-' (__) (__) (_) (__)

Link to comment
Share on other sites

Global $iIndex = 0, $sListData1 = "C:\Users\user pc\Desktop\mapa\lijsten\list1.txt"
Global $sListFile1 = "C:\Users\user pc\Desktop\mapa\lijsten\list1.txt"

If FileExists($sListFile1) Then
    $sListData1 = StringReplace(FileRead($sListFile1), @CRLF, "|")
EndIf

GUICtrlSetData($List1, $sListData1)
_GUICtrlListBox_SetCurSel($List1, $iIndex)

 

Edited by ViciousXUSMC
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...