FrancescoDiMuro

Replace 2 or more characters from a string

21 posts in this topic

#1 ·  Posted (edited)

Good morning :)
I was trying to replace 2 identical characters from a string, but I didn't manage to with StringReplace()...
Does anyone know how to replace two ( i.e. : """" with ";" ) ? 
Thanks :) 

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites



#2 ·  Posted

are there other cases, or just if you see four quotes change the middle two?  Or is that just two quotes inside quotes around the string?

anyway, the literal answer with the most edge cases:

$string = '""""'

msgbox(0, '' , stringleft($string , 1) & stringreplace(stringtrimleft(StringTrimRight($string , 1) , 1) , '""' , ";") & stringright($string , 1))

 


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

Share this post


Link to post
Share on other sites

#3 ·  Posted

Maybe this works? 

Local $sOriginal = "1ixxj00u!!_((sometthinng"
Local $sFinal = ""

For $i = 1 To StringLen($sOriginal)
    $sOne = StringMid($sOriginal, $i, 1)
    $sTwo = StringMid($sOriginal, $i+1, 1)
    If $sOne = $sTwo Then
        $sFinal = $sFinal & ";"
        $i = $i + 1
    Else
        $sFinal = $sFinal & $sOne
    EndIf
Next

ConsoleWrite("Final: " & $sFinal & @CRLF)

 


TY.

Share this post


Link to post
Share on other sites

#4 ·  Posted

Hey guys!
Thank you for the replies!
I have a string ( read from a file ) which has this format: 
 

5   "2017-03-24 09:21:16"   "-1:00" "System"    "Application"   "Change to operating mode 'online'."        4opute

When I read the file, the first operation I do with this string is:
 

$aFileAudit_TXT_Content[$i] = StringStripWS($aFileAudit_TXT_Content[$i], $STR_STRIPSPACES)

So, I have the string without all those spaces...
Then, I'd like to have something like a CSV file format, so, the string after StringStripWS would be like:
 

5"2017-03-24 09:21:16""-1:00""System""Application""Change to operating mode 'online'."4opute

Do you guys see that there are too many double quotes, and I'd like to have just this kind of format:
 

5;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'.;4opute

So, I can have something more familiar compared to a CSV.

Practically, I need to replace 2 double quotes ( in code, """"), with just one ; 
Hope I've been clear as possible :) 
Thanks for your help!


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#5 ·  Posted

7 minutes ago, FrancescoDiMuro said:

I'd like to have just this kind of format:
 

5;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'.;4opute
Local $sOriginal = '"2017-03-24 09:21:16""-1:00""System""Application""Change to operating mode ''online''."4opute'
Local $sFinal = ""

For $i = 1 To StringLen($sOriginal)
    $sOne = StringMid($sOriginal, $i, 1)
    $sTwo = StringMid($sOriginal, $i+1, 1)
    If $sOne = '"' And $sTwo = '"' Then
        $sFinal = $sFinal & '"'
        $i = $i + 1
    Else
        $sFinal = $sFinal & $sOne
    EndIf
Next

;finally replace " with ;
$sFinal = StringReplace($sFinal, '"', ';')
ConsoleWrite("Final: " & $sFinal & @CRLF)
;The result is --> ;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'.;4opute

 

If you don't want to replace " with ; then comment out the string replace line

a


TY.

Share this post


Link to post
Share on other sites

#6 ·  Posted (edited)

Local $string = '"2017-03-24 09:21:16""-1:00""System""Application""Change to operating mode ''online''."4opute'

msgbox(0, '' , stringreplace(stringreplace(stringreplace($string , '""' , ";") , "''" , "'"), '"' , ""))

 

Edited by iamtheky

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

Share this post


Link to post
Share on other sites

#7 ·  Posted (edited)

7 minutes ago, iamtheky said:
Local $string = '"2017-03-24 09:21:16""-1:00""System""Application""Change to operating mode ''online''."4opute'

msgbox(0, '' , stringreplace(stringreplace(stringreplace($string , '""' , ";") , "''" , "'"), '"' , ""))

 

I get all "", all ; and all spaces removed...
That's not what I was talking about... 
Maybe because the string you used it's not like the string I've posted... :/

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#8 ·  Posted

18 minutes ago, taylansan said:
Local $sOriginal = '"2017-03-24 09:21:16""-1:00""System""Application""Change to operating mode ''online''."4opute'
Local $sFinal = ""

For $i = 1 To StringLen($sOriginal)
    $sOne = StringMid($sOriginal, $i, 1)
    $sTwo = StringMid($sOriginal, $i+1, 1)
    If $sOne = '"' And $sTwo = '"' Then
        $sFinal = $sFinal & '"'
        $i = $i + 1
    Else
        $sFinal = $sFinal & $sOne
    EndIf
Next

;finally replace " with ;
$sFinal = StringReplace($sFinal, '"', ';')
ConsoleWrite("Final: " & $sFinal & @CRLF)
;The result is --> ;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'.;4opute

 

If you don't want to replace " with ; then comment out the string replace line

a

Same for you buddy... What I want to replace is the double quotes with a single ;
 


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#9 ·  Posted

FrancescoDiMuro,

You need a RegEx:

Local $sString = '5"2017-03-24 09:21:16""-1:00""System""Application""Change to operating mode ''online''."4opute'

$sNewString = StringRegExpReplace($sString, '\x22{1,2}', ";")

ConsoleWrite($sNewString & @CRLF)
ConsoleWrite("5;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'.;4opute" & @CRLF)

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#10 ·  Posted (edited)

Hey @Melba23
I was trying your code, but I have always the same result!

This is the line I read from the file:

5"2017-03-24 09:21:16""-1:00""System""Application""Change to operating mode 'online'."4opute

And this is what I'd like to have:

5;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'."4opute

I can then do a StringReplace(5;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'."4opute, '"', ";") and have finally:

5;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'.;4opute

But, with all your scripts, I can't manage to have my wanted result...
This is my full script:
 

#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <StringConstants.au3>


Global $sCartellaAudit_TXT = @ScriptDir & "\Audit_TXT\"

Global $aFileAudit_TXT = _FileListToArray($sCartellaAudit_TXT, "*.txt", $FLTA_FILES)

Global $sFileAudit_TXT = $aFileAudit_TXT[1]

Local $hFileAudit_TXT = FileOpen($sCartellaAudit_TXT & $sFileAudit_TXT, $FO_READ)

Local $sFinal

If($hFileAudit_TXT <> -1) Then
    Local $aFileAudit_TXT_Content
    _FileReadToArray($sCartellaAudit_TXT & $sFileAudit_TXT, $aFileAudit_TXT_Content)
    If(IsArray($aFileAudit_TXT_Content)) Then
        For $i = 0 To UBound($aFileAudit_TXT_Content) - 1
            $aFileAudit_TXT_Content[$i] = StringStripWS($aFileAudit_TXT_Content[$i], $STR_STRIPSPACES)
        Next
        For $i = 0 To UBound($aFileAudit_TXT_Content) - 1
            $aFileAudit_TXT_Content[$i] = StringRegExpReplace($aFileAudit_TXT_Content[$i], '\x22{1,2}', ";")
        Next
        _ArrayDisplay($aFileAudit_TXT_Content, "Array:")
    Else
        MsgBox($MB_ICONERROR, "Errore!", "$aFileAudit_TXT_Content non è un array!" & @CRLF & "Errore: " & @error)
    EndIf
Else
    MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'apertura del file:" & @CRLF & $sFileAudit_TXT & @CRLF & "Errore: " & @error)
EndIf

I divided the two For just to try if I had to do first a StringStripWS and then a StringRegExpReplace... But nothing changed...

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#11 ·  Posted

this?

Local $string = '5"2017-03-24 09:21:16""-1:00""System""Application""Change to operating mode ''online''."4opute'

msgbox(0, '' , stringreplace(stringreplace(stringreplace($string , '""' , ";") , "''" , "'"), '"' , ";"))

 


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

Share this post


Link to post
Share on other sites

#12 ·  Posted (edited)

FrancescoDiMuro,

It works for me - once you get the correct formatting for the string:

Local $sString = '5"2017-03-24 09:21:16""-1:00""System""Application""Change to operating mode ''online''."4opute'

$sNewString = StringRegExpReplace($sString, '\x22{1,2}', ";")

ConsoleWrite("Original string:" & @CRLF & _
                $sString & @CRLF & _
                "New string:" & @CRLF & _
                $sNewString & @CRLF & _
                "Compared to what you required" & @CRLF & _
                "5;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'.;4opute" & @CRLF)

gives me:

Original string:
5"2017-03-24 09:21:16""-1:00""System""Application""Change to operating mode 'online'."4opute
New string:
5;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'.;4opute
Compared to what you required
5;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'.;4opute

M23

Edited by Melba23
Wrong format for second code tag

Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#13 ·  Posted

All of our results (@Melba23 and @iamtheky and me); are the same. All these three solutions give the result, one to one match with your "expected" output. 

P.S: This is genius btw. 

8 minutes ago, Melba23 said:

'\x22{1,2}'

 


TY.

Share this post


Link to post
Share on other sites

#14 ·  Posted

@Melba23
This is copied from the _ArrayDisplay...
I get that array element and pass it to StringRegExpReplace...

Row|Col 0
[3]|5    "2017-03-24 09:21:16"    "-1:00"    "System"    "Application"    "Change to operating mode 'online'."    4opute


This is my result:

Row|Col 0
[3]|5    ;2017-03-24 09:21:16;    ;-1:00;    ;System;    ;Application;    ;Change to operating mode 'online'.;    4opute

Can you please tell me why? :)


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#15 ·  Posted

FrancescoDiMuro,

You said earlier:

Quote

the first operation I do with this string is: [...] StringStripWS

And so the code I posted works on the already stripped string - as a simple glance at either the code or result I posted above clearly shows.

Running the RegEx without removing the spaces will just replace single " - as is shown by your result. Stripping the spaces will remove both " and "" - which was your original request.

So take your string, strip the spaces and then run the RegEx - then you will get the result you wish.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#16 ·  Posted (edited)

Sorry for posting "wrong" examples...
Seems that _ArrayDisplay add it's own spaces to the rows...

As I've already told you, when I read the file through _FileReadToArray(), then, I manage the array returned by _FileReadToArray(), and, the first thing I do with the array, is StringStripWS through every row of the array, in order to remove the spaces ( 2 or more with the parameter $STR_STRIPSPACES ), and then I do the StringRegExpReplace as you suggested to me... But the result I obtain IS what I've posted above and I'll post again here:

This is what I LITERALLY read from the array:

Quote

"2017-03-24 09:21:16""-1:00""System""Application""Change to operating mode 'online'." 4opute

This is what I LITERALLY obtain from the StringStripWS() before and then StringRegExpReplace():

Quote

;2017-03-24 09:21:16;;-1:00;;System;;Application;;Change to operating mode 'online'.;4opute
 

This is the code I'm working on:

#include <AutoItConstants.au3>
#include <MsgBoxConstants.au3>
#include <FileConstants.au3>
#include <File.au3>
#include <Array.au3>
#include <StringConstants.au3>


Global $sCartellaAudit_TXT = @ScriptDir & "\Audit_TXT\"

Global $aFileAudit_TXT = _FileListToArray($sCartellaAudit_TXT, "*.txt", $FLTA_FILES)

Global $sFileAudit_TXT = $aFileAudit_TXT[1]

Local $hFileAudit_TXT = FileOpen($sCartellaAudit_TXT & $sFileAudit_TXT, $FO_READ)

Local $sFinal

If($hFileAudit_TXT <> -1) Then
    Local $aFileAudit_TXT_Content
    _FileReadToArray($sCartellaAudit_TXT & $sFileAudit_TXT, $aFileAudit_TXT_Content)
    If(IsArray($aFileAudit_TXT_Content)) Then
        For $i = 0 To UBound($aFileAudit_TXT_Content) - 1
            $aFileAudit_TXT_Content[$i] = StringStripWS($aFileAudit_TXT_Content[$i], $STR_STRIPSPACES)
            $aFileAudit_TXT_Content[$i] = StringRegExpReplace($aFileAudit_TXT_Content[$i], '\x22{1,2}', ";")
        Next
        _ArrayDisplay($aFileAudit_TXT_Content, "Array:")
    Else
        MsgBox($MB_ICONERROR, "Errore!", "$aFileAudit_TXT_Content non è un array!" & @CRLF & "Errore: " & @error)
    EndIf
Else
    MsgBox($MB_ICONERROR, "Errore!", "Errore durante l'apertura del file:" & @CRLF & $sFileAudit_TXT & @CRLF & "Errore: " & @error)
EndIf

Try it yourself since I can't be understood through my words...

AuditTrailDosaggio0_20170324_131507_DOSAGGIO_PW_01.txt

Edited by FrancescoDiMuro

Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#17 ·  Posted

FrancescoDiMuro,

It is the  StringStripWS command that is the problem - it is not returning the stripped string in the format you believe it should. I am looking into it.

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#18 ·  Posted

Thank you so much @Melba23:)
Waiting for your response :)
 


Click here to see my signature:

Spoiler

I will always thank you for the time you spent for me.
I'm here to ask, and from your response, I'd like to learn.
By my knowledge, I can help someone else, and "that someone" could help in turn another, and so on.

Share this post


Link to post
Share on other sites

#19 ·  Posted

FrancescoDiMuro,

First an explanation. You were using $STR_STRIPSPACES with StringStripWS - this removes all multiple spaces between the words, which is required because you want to keep the spacing of the "Change to operating mode" section. However, doing this did not remove the single space between these elements ("-1:00" "System") nor did it remove the @TABs that form the first and final whitespace elements of the line. So the stripped string did not match what you believed you were getting - which is why you did not get the results expected when you ran the proposed solutions. You were not providing us with the actual input that you were using - a good case of GIGO

The solution is a RegEx that removes all of the unwanted whitespace (both space and tab) while retaining the spacing within the  "Change to operating mode" section:

$sString = '5   "2017-03-24 09:21:16"   "-1:00" "System"    "Application"   "Change to operating mode ''online''."      4opute'

$sStrippedString = StringRegExpReplace($sString, '("\h+"|\h+"|"\h+)', ";")

ConsoleWrite($sString & @CRLF)
ConsoleWrite($sStrippedString & @CRLF)

It looks for any horizontal whitespace (i.e. both space and tab) preceded, followed, or surrounded by a " - this way it leaves the internal spaces - here is the result I get:

5   "2017-03-24 09:21:16"   "-1:00" "System"    "Application"   "Change to operating mode 'online'."        4opute
5;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'.;4opute

So use this RegEx in place of both the StringStripWS & StringRegExpReplace lines you were previously using and you should get what you require - I certainly do when I run it on the file you posted:

For $i = 1 To $aFileAudit_TXT_Content[0]
    $aFileAudit_TXT_Content[$i] = StringRegExpReplace($aFileAudit_TXT_Content[$i], '("\h+"|\h+"|"\h+)', ";")
Next
5;2017-03-24 09:21:16;-1:00;System;Application;Change to operating mode 'online'.;4opute
6;2017-03-24 09:21:17;-1:00;System;User administration;User administration imported successfully.;y7Ugni
7;2017-03-24 09:21:49;-1:00;Admin;User administration;User 'Admin' logged on with group 'Amministratore_DOS_PW'.;YB/XAZ
8;2017-03-24 09:21:49;-1:00;Admin;Application;Shutting down application.;PnTovK

M23


Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind._______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

 

Share this post


Link to post
Share on other sites

#20 ·  Posted

Melba,
Nice explanation. You could also do it like this (tiny difference)

StringRegExpReplace($sString, '\h*"\h*"?', ";")

 

Share this post


Link to post
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

  • Similar Content

    • KimberlyJillPereira
      By KimberlyJillPereira
      May I know how to copy the first 10 characters in excel and paste it in the file explorer textbox? How to do? I know that you show use the StringLeft() function but I am not sure how to do. Please help me. Thank you! 


    • Paranthaman
      By Paranthaman
      Hi,
      I want to click a link by the element ID through IEGetObjById.
      <!DOCTYPE html> <html> <body> <button type="button" id="Random-1-ID" onclick="alert('Hello world!')"></button> </body> </html> I intend to click the button with ID"Random-1-ID". But on every refresh the ID changes to next number like "Random-2-ID" "Random-3-ID"
       
      The code i which i wrote for this function is
      #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("I:\Documents\1. Work\Automation\My codes\Collections\11. Clicking button by Value and ID\button.html") Local $oDiv = _IEGetObjById($oIE, "Random-1-ID") _IEAction($oDiv, "click") _IELoadWait($oIE) So can anyone help me to alter this code like it clicks for every ID in format "Random-%-ID"
    • Surf243
      By Surf243
      I'm having a weird issue with an invisible character (specifically: '?' mark) appearing in my CSV when my script reads it. I've isolated it down to a simple script so I can share it easily.
      Has anyone experienced this issue?
      How would I be able to detect/remove invisible characters?
      For this specific case FileExist would fail. I could do StringReplace or StringRegExp, but what if it's not a '?' mark or a unc path?
      Note: I can see the question mark if I open the CSV in notepad, but not in Excel.
       
      Code:
      $sPath1 = "\\Server\Share\Folder1‎" ; Copied from Excel 2013 $sPath2 = "\\Server\Share\Folder1" ; Typed out in SciTE ConsoleWrite(@CRLF) ConsoleWrite($sPath1 & @TAB & StringLen($sPath1)) ConsoleWrite(@CRLF) ConsoleWrite($sPath2 & @TAB & StringLen($sPath2)) ConsoleWrite(@CRLF & @CRLF) Screenshot:

      Script:
      Path_Test.au3
       
      Any assistance is appreciated, Thanks!
    • ur
      By ur
      I am assigning the current time stamp to a variable $strtTime and holding the execution for 5 seconds with Sleep and calculating the current time stamp.
      Ideally, the _DateDiff should give 5 seconds as output as i gave the parameter as s.But it is giving zero 0.
      Any suggestions....!
      Global $startTime = _Date_Time_GetLocalTime() $startTime = _Date_Time_SystemTimeToDateTimeStr($startTime) Sleep(5000)     $tCur = _Date_Time_GetLocalTime()     $tCur = _Date_Time_SystemTimeToDateTimeStr($tCur) $iDateCalc = _DateDiff('s', $startTime, $tCur)     MsgBox(0,"$iDateCalc",$iDateCalc)     FileWrite ($QTPfile,CHr(34) & $tCur & CHr(34) & Chr(44) & """" & $iDateCalc & """,")  
    • TheDcoder
      By TheDcoder
      Hello, I am in a little confusion with Boolens , Here is my code:
      ConsoleWrite(("Something" = "Samething") & @CRLF) ; False ConsoleWrite((Not "Something" = "Samething") & @CRLF) ; True ConsoleWrite((Not False) & @CRLF) ; True I have commented the results which I expected, but the expression in the 2nd line is not working as expected , Can anyone explain to me?
      SciTE Output:
      Thanks in Advance, TD