StringReplace minor problem
-
Recently Browsing 0 members
No registered users viewing this page.
-
Similar Content
-
By cdeb
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()
output is:
$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
For cycle
Local $aArray = StringSplit($sSubject, "", $STR_NOCOUNT) For $i = 0 To UBound($aArray)-1 ConsoleWrite($aArray[$i] & " - " & Asc($aArray[$i])& @CR) Next Output:
? - 63
? - 63
- 32
5 - 53
- 32
o - 111
f - 102
- 32
t - 116
h - 104
e - 101
- 32
Does anyone have an explanation of why it doesn't work?
Thank you all
-
By jmp
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[5][1] Local $sitem2 = $aTableData3[5][2] 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.
-
By Tippex
I have a problem with FileOpenDialog using long default filenames ... they always get truncated.
For example:
"A Long FileName.mpg" as a default would prompt as just "FileName.mpg" (but scrolling left will show it named correctly).
Does anyone know of a fix for this please (I didn't spot it in a Forum search), or is it one for the bug tracker?
#include <FileConstants.au3> #include <MsgBoxConstants.au3> Local Const $sMessage = "Hold down Ctrl or Shift to choose multiple files." Local $sFileOpenDialog = FileOpenDialog($sMessage, @WindowsDir & "\", "Images (*.jpg;*.bmp)|Videos (*.avi;*.mpg)", BitOR($FD_FILEMUSTEXIST, $FD_MULTISELECT), "A Long FileName.mpg") Thanks,
-
By nacerbaaziz
Hello, dears.
First I apologise to you for the stupid question I'm going to ask.
is the default style for Windows created using AutoIt a dialog box style?
I decided to ask this question
Because I am using a screen reader
If i open any program that is designed using autoit, the screen reader read for example,
test dialog
but If i open any other program, for example goldwave, it read goldwav only without a word dialog
Is there a solution to this
The code i used to create the window is:
$hGUI = GUICreate(str("title"), 500, 420, -1, -1, BitOr($WS_MAXIMIZEBOX, $WS_MINIMIZEBOX, $WS_SIZEBOX, $WS_SYSMENU, $WS_CAPTION), BitOr($WS_EX_ACCEPTFILES,$WS_EX_LAYERED,$WS_EX_CLIENTEDGE,$WS_EX_STATICEDGE))
I hope to find a solution to this problem
please Accept my greetings, and thank you very much.
-
By smartkey
Hi All,
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
Else
$OUTPUT_STRING = StringMid($INPUT_STRING,1,1)
EndIf
For $i=2 to StringLen($INPUT_STRING)
If StringMid($INPUT_STRING,$i,1) = $STR_2_FIND Then
$OUTPUT_STRING= $OUTPUT_STRING & $STR_2_REPLACE
Else
$OUTPUT_STRING= $OUTPUT_STRING & StringMid($INPUT_STRING,$i,1)
EndIf
Next
Return $OUTPUT_STRING
Else
Return 0
EndIf
EndFunc
-
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now