Jump to content
ioripalm

Why is the result of this code not the same as expected?

Recommended Posts

ioripalm
Posted (edited)

Why is the result of this code not the same as expected?

Dim $sArray[5] = ["PARENTEMAIL                    ", "OPTSTRAND                      ", "POSTCODE                       ", "STRAND                         ", "TECETHN                        "]
$sum = ""
For $i = 0 To UBound($sArray) - 1
    $sum &= $sArray[$i]
Next
ConsoleWrite($sum & @CRLF)

result:

PARENTEMAIL                    OPTSTR                      POSTCODE                       STR                         TECETHN                        

error.thumb.jpg.3b306c5a8c43c5545ed7f36d99dc45d1.jpg

Editer is SciTE
Ver 3.6.2  Feb 15 2016 18:42:26

 

Why its stripping "AND" from the string?

Edited by ioripalm

Share this post


Link to post
Share on other sites
Subz

What did you expect?

Share this post


Link to post
Share on other sites
Jos

I guess the question is why the "AND" portion is disappearing from the concatenated string while they are in the Array?

Jos


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
Melba23

ioripalm,

When I run that code I get what you expect:

PARENTEMAIL                    OPTSTRAND                      POSTCODE                       STRAND                         TECETHN

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
Subz

@Jos Didn't even notice that, till you pointed it out, really need to start wearing my reading glasses :) 

@Melba23 Get the same result as you, so not sure why its stripping "AND" from the string for the OP.

Share this post


Link to post
Share on other sites
ioripalm
On 2018/3/15 at 1:36 PM, Subz said:

What did you expect?

Sorry,I edited this question and a pic of displayed my result.

Share this post


Link to post
Share on other sites
ioripalm
On 2018/3/15 at 10:12 PM, Melba23 said:

ioripalm,

When I run that code I get what you expect:

PARENTEMAIL                    OPTSTRAND                      POSTCODE                       STRAND                         TECETHN

M23

Thank you,but in my Console I can't see "AND".

 

 

Share this post


Link to post
Share on other sites
Jos
Posted (edited)

.. and you are running the exact same snippet?
What is the file encoding you use?

Jos

Edited by Jos

Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
jchd

I get the same result as Melba and al. here.

Is it an old localized version of basic SciTE (w/o SciTE4AutoIt3)?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

Share this post


Link to post
Share on other sites
Bilgus

What if you try other commands in the strings like or Not NULL

Local $sArray[5] = ["PARENTENULL                    ", "OPTSTRAND                      ", "POSTCOOR                       ", "STRNOT                         ", "TECETIF                        "]
$sum = ""
For $i = 0 To UBound($sArray) - 1
    $sum &= $sArray[$i]
Next
ConsoleWrite($sum & @CRLF)
;What About without spaces?
Local $sArray[5] = ["PARENTENULL_", "OPTSTRAND_", "POSTCOOR_", "STRAND_", "TECETIF_"]
$sum = ""
For $i = 0 To UBound($sArray) - 1
    $sum &= $sArray[$i]
Next
ConsoleWrite($sum & @CRLF)

 

Share this post


Link to post
Share on other sites
ioripalm
Posted (edited)
17 hours ago, Bilgus said:

What if you try other commands in the strings like or Not NULL

Local $sArray[5] = ["PARENTENULL                    ", "OPTSTRAND                      ", "POSTCOOR                       ", "STRNOT                         ", "TECETIF                        "]
$sum = ""
For $i = 0 To UBound($sArray) - 1
    $sum &= $sArray[$i]
Next
ConsoleWrite($sum & @CRLF)
;What About without spaces?
Local $sArray[5] = ["PARENTENULL_", "OPTSTRAND_", "POSTCOOR_", "STRAND_", "TECETIF_"]
$sum = ""
For $i = 0 To UBound($sArray) - 1
    $sum &= $sArray[$i]
Next
ConsoleWrite($sum & @CRLF)

 

return these:

PARENTENULL                    OPTSTR                      POSTCOOR                       STRNOT                         TECETIF                        
PARENTENULL_OPTSTRAND_POSTCOOR_STRAND_TECETIF_

Dim $sArray[5] = ["@PARENTEMAIL                    @", "@OPTSTRAND                      @", "@POSTCODE                       @", "@STRAND                         @", "@TECETHN                        @"]
$sum = ""
For $i = 0 To UBound($sArray) - 1
    $sum &= $sArray[$i]
Next
ConsoleWrite($sum & @CRLF)

I added "@" before and after the string
return:@PARENTEMAIL                    @@OPTSTR                      @@POSTCODE                       @@STR                         @@TECETHN                        @

unicode.thumb.png.d71858646bc17113eb243f364dc0f2ba.png

Edited by ioripalm

Share this post


Link to post
Share on other sites
ioripalm
22 hours ago, Jos said:

.. and you are running the exact same snippet?
What is the file encoding you use?

Jos

UTF8 none BOM

unicode.png.ada833f9b7486f2bf7196024910bd96c.png

Share this post


Link to post
Share on other sites
Jos
17 minutes ago, Jos said:

Can you please show the total output shown in the SciTE output pane when you run the script in codebox (<>)?

Jos

... and?


Visit the SciTE4AutoIt3 Download page for the latest versions  - Beta files                                How to post scriptsource        Forum Rules
 
Live for the present,
Dream of the future,
Learn from the past.
  :)

Share this post


Link to post
Share on other sites
ioripalm
Posted (edited)
3 minutes ago, Jos said:

... and?

>"C:\Program Files (x86)\AutoIt3\SciTE\AutoIt3Wrapper\AutoIt3Wrapper.exe" /run /prod /ErrorStdOut /in "C:\Users\Mason\Desktop\oop\OOP\testerror.au3" /UserParams    
+>11:10:41 启动 AutoIt3Wrapper v16.306.1237.0  SciTE v3.6.2.0   键盘:00000804  操作系统:WIN_10/  CPU:X64  系统架构:X64  语言环境:0804  代码页:936
> utf8 检查: 4 # 检测 ASCII 字符,如无默认设置,则编码为 UTF-8 无 BOM.
> 脚本编码: 256 UTF8 无 BOM.
+> SciTE 目录 => C:\Program Files (x86)\AutoIt3\SciTE  AutoIt3Wrapper 用户目录 => C:\Users\Mason\AppData\Local\AutoIt v3\SciTE\AutoIt3Wrapper   SCITE 用户目录 => C:\Users\Mason\AppData\Local\AutoIt v3\SciTE 
>运行 AU3Check (3.3.14.2) 检查代码.  参数: C:\Program Files (x86)\AutoIt3  脚本路径: C:\Users\Mason\Desktop\oop\OOP\testerror.au3
+>11:10:41 AU3Check 语法检查结束.rc: 0
>运行:C:\Program Files (x86)\AutoIt3\autoit3_x64.exe(3.3.14.2), 脚本: C:\Program Files (x86)\AutoIt3\autoit3_x64.exe "C:\Users\Mason\Desktop\oop\OOP\testerror.au3"    
--> 点击 Ctrl+Alt+Break 重新启动, 或 Ctrl+Break 停止脚本执行
PARENTEMAIL                    OPTSTR                      POSTCODE                       STR                         TECETHN                        
+>11:10:42 AutoIt3.exe 结束.rc: 0
+>11:10:42 AutoIt3Wrapper 完成脚本处理.
>Exit code: 0    Time: 0.8471

Sorry,I user Chinese version SciTE.

Edited by ioripalm

Share this post


Link to post
Share on other sites
jchd

That's why I asked which version and setup was used. If you're using a homebrew setup for linking (old) SciTE to (old) AutoIt tools, then isn't there something at this level that could interfere with SciTE console output? I don't believe that by itself codepage gb2312  (simplifies Chinese) would interpret the substring 'AND' by anything else, or remove it altogether.

Can you install latest SciTE4AutoIt3 and AutoIt3 packages elsewhere and retry the same test?


This wonderful site allows debugging and testing regular expressions (many flavors available). An absolute must have in your bookmarks.
Another excellent RegExp tutorial. Don't forget downloading your copy of up-to-date pcretest.exe and pcregrep.exe here
RegExp tutorial: enough to get started
PCRE v8.33 regexp documentation latest available release and currently implemented in AutoIt beta.

SQLitespeed is another feature-rich premier SQLite manager (includes import/export). Well worth a try.
SQLite Expert (freeware Personal Edition or payware Pro version) is a very useful SQLite database manager.
An excellent eBook covering almost every aspect of SQLite3: a must-read for anyone doing serious work.
SQL tutorial (covers "generic" SQL, but most of it applies to SQLite as well)
A work-in-progress SQLite3 tutorial. Don't miss other LxyzTHW pages!
SQLite official website with full documentation (may be newer than the SQLite library that comes standard with AutoIt)

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

×