Jump to content
Sign in to follow this  
jmichae3

auto string conversion to numbers interfering with string work

Recommended Posts

jmichae3

autoit doesn't work auto-interchangeably with Numbers and strings. to do the parsing I do, I have to work 1 char at a time or handle a whole integer string.

it might be in the middle of 2/2/2013 23:59:59.123 or 5 minutes for instance.  so I have a problem.

as soon as I do $ch=stringmid($str,$i,1) and it happens to be a "5" in 5min for instance, it converts the "5" to a Number. from then on, I can't process the string as a string and append chars with &= and have it still come out as a string, it comes out as a number as soon as it hits a digit during lexing.

is there a workaround to force it to be a string? if I want something to be a Number() or Int() I can always use those functions, but this is interfering with my kitchentimer.

Share this post


Link to post
Share on other sites
michaelslamet

$str = "5min"
$ch = stringmid($str,1,1)

$ch &= "sec"

Msgbox(0,"",$ch)             ; will display "5sec"

 

WinXP, AutoIT 3.8.8.1

Seems working "right" on my system

Share this post


Link to post
Share on other sites
PhoenixXL

there is also a function, String() for converting numbers to string. You may find it helpful.

EDIT: It seems I have some misunderstanding, because I'm always in the same scenario but never faced any such problem.

It would be better if you show the code( or reproducer ).

Edited by PhoenixXL

My code:

PredictText: Predict Text of an Edit Control Like Scite. Remote Gmail: Execute your Scripts through Gmail. StringRegExp:Share and learn RegExp.

Run As System: A command line wrapper around PSEXEC.exe to execute your apps scripts as System (LSA). Database: An easier approach for _SQ_LITE beginners.

MathsEx: A UDF for Fractions and LCM, GCF/HCF. FloatingText: An UDF for make your text floating. Clipboard Extendor: A clipboard monitoring tool. 

Custom ScrollBar: Scroll Bar made with GDI+, user can use bitmaps instead. RestrictEdit_SRE: Restrict text in an Edit Control through a Regular Expression.

Share this post


Link to post
Share on other sites
jchd

autoit doesn't work auto-interchangeably with Numbers and strings. to do the parsing I do, I have to work 1 char at a time or handle a whole integer string.

it might be in the middle of 2/2/2013 23:59:59.123 or 5 minutes for instance.  so I have a problem.

as soon as I do $ch=stringmid($str,$i,1) and it happens to be a "5" in 5min for instance, it converts the "5" to a Number. from then on, I can't process the string as a string and append chars with &= and have it still come out as a string, it comes out as a number as soon as it hits a digit during lexing.

is there a workaround to force it to be a string? if I want something to be a Number() or Int() I can always use those functions, but this is interfering with my kitchentimer.

Do you have actual sample reproducing code causing issue or is it just out of the blue?


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
jmichae3

language conversion bug of mine, never mind I think. I was converting from js, and js uses + for string concat. autoit uses + to turn  a char into a number interestingly enough. but I used the wrong op. so many times it's just me. I thought I had converted the code OK, but... :-/ sorry guys. thanks for the help. normally I just lose hair... funny, it's laying at my keyboard :-)

Edited by jmichae3

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
Sign in to follow this  

×