Recently Browsing 0 members
No registered users viewing this page.
As for the object, in this case the StringReplace() function does not work for me.
These are my steps:
1) Extract the subject from an EML file.
(the first character is an emoji )
source from EML file:
$sSubject = "?utf-8?B?8J+TiCA1IG9mIHRoZSBCZXN0IFN0b2NrcyB0byBCdXkgZm9yIERlY2VtYmVy?=" 2) in this case I perform a decoding with _QuotedPrintable_DecodeEncodedWord()
$sSubject = "?? 5 of the Best Stocks to Buy for December"
3) I perform StringReplace():
$sSubject = StringReplace($sSubject, "??", "") or
$sSubject = StringReplace($sSubject, Chr(63)&Chr(63), "")
But the characters ?? they are not replaced.
Yet if I make an Asc of every character of the string with a for loop, are the first two characters really? that is 63
Local $aArray = StringSplit($sSubject, "", $STR_NOCOUNT) For $i = 0 To UBound($aArray)-1 ConsoleWrite($aArray[$i] & " - " & Asc($aArray[$i])& @CR) Next Output:
? - 63
? - 63
5 - 53
o - 111
f - 102
t - 116
h - 104
e - 101
Does anyone have an explanation of why it doesn't work?
Thank you all
I am adding labour charge to total paid amount using :
#include <IE.au3> #include <Array.au3> $oIE = _IEAttach ("Shop") $oTable = _IETableGetCollection ($oIE, 1) $aTableData3 = _IETableWriteToArray ($oTable) Local $sitem1 = $aTableData3 Local $sitem2 = $aTableData3 Local $lcharge = "10" ;add manualy using inputbox, becuase not generating online Local $atotPric = "Payable Total Price " Local $oTds = _IETagNameGetCollection($oIE, "td") For $oTd In $oTds If $oTd.Innertext = $atotPric Then $iatotPric = $oTd.NextElementSibling.innertext MsgBox (0, "2", $iatotPric) EndIf Next $irCtotal = StringFormat("%.2f", $sitem1 + $sitem2 + $lcharge) $crTotp = StringReplace(_IEBodyReadHTML($oIE), $iatotPric, $irCtotal) _IEBodyWriteHTML ($oIE, $crTotp) But, It was also changing Total price, I want to change only Payable Total Price.
(Edited from original. Please note that I AM NOT AN AUTOIT EXPERT. I write code using Autoit frequently but I am no expert, especially when it comes to I/O. So any remarks that start with "Why did you..." can be answered by referring to the first sentence. This project was done in Autoit because of an interface I built to display the data.)
Attached is a program and ascii input file I wrote to read stock price data, convert it to binary and then read it back into the program in binary. The goal was to show increased performance for reading the files in binary and provide a demo on how to read/write binary for int32, int64, double and strings for anyone who might find it helpful. The results on my PC show the following:
Time to read ascii file only: 456.981951167202
Ascii read & process time: 6061.83075631701
Binary write file time: 14787.9184635239
Time just to read binary file: 42.418867292311
Binary read and process time: 4515.16129830537
A couple things to note:
1) The 32 MB ascii file took 10x longer to read than the 15 MB binary file. Not entirely sure why. Both were read into a buffer.
2) The Binary write takes a long time but I made no effort to optimize this because the plan was to write this file one time only so I don't mind if it takes longer to write this file. I care much more about how long it takes to read the file because I will be reading it many times.
3) There was a modest gain in converting the ascii file to binary in terms of file size and reading speed.
So big picture... not sure it's worth the effort to convert the files to binary even though most of the data is numerical data in the binary file. That was actually surprising as I expected there would be more of a difference. Any ideas on how to get the binary data to read at a faster rate would be great.
Default keyword for optional parameter is interpreted wrongly.
ConsoleWrite(StringReplace("aa", "a", "b", Default, 1) & @CRLF) StringReplace ( "string", "searchstring/start", "replacestring" [, occurrence = 0 [, casesense = 0]] ) The code above will output ab even thou the default value for the occurrence is 0 (replace all).
Of course using zero instead of Default will work fine.
I have written a UDF for one of my requirement which replaces a single character in string with a sub string/another character.
I am using this for my requirement by calling below function as StrReplace("C:\Software\Autoit\Substr","\","\\") and gives result as C:\\Software\\Autoit\\Substr
Please let me know if this can be improvised or any mistakes to correct.
; Function Name: StrReplace($INPUT_STRING)
; Description: This function is to replace a character with another in a string.
; Parameter(s): $INPUT_STRING - Original String Value
; $STR_2_FIND - Single Character to find the $INPUT_STRING
; $STR_2_REPLACE - Substring/Multiple Characters to replace in place of $STR_2_FIND value
; Requirement(s): Replacing one single Character in a string with multiple Characters
; Return Value(s): success - Output string after replacing a character with required character
; failure - 0
; Author(s): smartkey
Func StrReplace($INPUT_STRING, $STR_2_FIND, $STR_2_REPLACE)
Local $OUTPUT_STRING = ""
If StringLen($INPUT_STRING) > 0 Then
If StringMid($INPUT_STRING,1,1) = $STR_2_FIND Then
$OUTPUT_STRING = $OUTPUT_STRING & $STR_2_REPLACE
$OUTPUT_STRING = StringMid($INPUT_STRING,1,1)
For $i=2 to StringLen($INPUT_STRING)
If StringMid($INPUT_STRING,$i,1) = $STR_2_FIND Then
$OUTPUT_STRING= $OUTPUT_STRING & $STR_2_REPLACE
$OUTPUT_STRING= $OUTPUT_STRING & StringMid($INPUT_STRING,$i,1)