Jump to content

Recommended Posts

Posted

Hey all! So I have a .txt file and I want autoit to load the textfile and remove all the spaces and [tab] spaces (the long spaces).

Thanks in advance

  • Moderators
Posted

senator,

Look at StringStripWS in the Help file.

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

I can't seem to get it to work.

Here's how my 'string' looks like:

text

text

text

text

text

text

text

..and so on..

And this line is supposed to write the string to a .txt file

FileWriteLine($path,StringStripCR($thestring))

The problem is it writes it without removing the spaces.

Posted (edited)

Thanks, before i try it out, is there any way to get it to "text,text,text,text" instead "texttexttext" ? Actually I'm sure there is a way lol

Edited by senator
Posted

1. StringStripWS(StringStripCR($users) is not good, it needs a flag. What should i put there.

2. FireFox, that would only work if my string was full of "text"s. Its more like "text, somethingelse,anotherword..."

  • Moderators
Posted

senator,

Get your text into an array - _FileReadToArray will do this for you. Then loop through the array:

; Just to have a test array for this example

$sString = "test    " & @CRLF & @CRLF & "test   "
$aArray = StringSplit($sString, @CRLF)

; Start here if you use _FileReadToArray

$sNewString = ""

For $i = 1 To $aArray[0]
    If StringLen($aArray[$i]) > 0 Then
        $sNewString &= StringStripWS($aArray[$i], 8) & ","
    EndIf
Next

ConsoleWrite($sNewString & @CRLF)

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

Posted

Hi,

I'm not certain but try something like

StringReplace('texttexttext', @LF, '')

followed by

StringReplace('texttexttext', @LR, '')

for each line of your file.

regards,

Antoine

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
  • Recently Browsing   0 members

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