Jump to content

Finished up a new UDF Word that I needed


kjactive
 Share

Recommended Posts

I just done a new UDF function library that some 'autoitters' might find usefull - Word.au3 contains some vital word related function that I needed as AutoIt StringSplit / StringInStr and StringMid functions can't handle both 0x09 and 0x20 characters in the same string without some hasle - this is 'words in strings' handle functions no matter...

This UDF library contains 9 word related functions to be included into autoit3 'include' directory and return @error = 1 as failure:

Name: Word.au3

AutoIt Version: 3.1.1

Language: English

Description: Functions to assist working with word in string data.

Requirement(s): None

Author: Kåre Johansson ( kjactive )

Functions:

_Word( $sString, $iInt )

_Words( $sString )

_Strip( $sString, $sKey )

_Copies( $sString, $iInt )

_SubWords( $sString, $iInt ,$iInt )

_DelWords( $sString, $iInt , $iInt )

_WordIndex( $sString, $iInt )

_DelString( $sString, $iInt, $iInt )

_Insert( $sString, $sString, $iInt )

_Say( $sString ) // just a fast ConsoleWrite debug function.

I Included documentation in Html form...

Free to download or include into AutoIt system:

http://www.sitecenter.dk/latenight/nss-fol...pports/Word.zip

kjactive :(

Edited by kjactive
Link to comment
Share on other sites

Well just fixed a miner bug and changed two function names to be more accurate what they do...

Download from site:

http://www.sitecenter.dk/latenight/nss-fol...pports/Word.zip

kjactive  :(

<{POST_SNAPBACK}>

You asked for it... :(

Here are some things I found...

1. All of your HTML examples would error due to a missing Left ")" in the statement, a couple of spelling issues and other text changes.

2. (2) HTML file names were not consistant will all the others DelWords & SubWords

3. The names of some of your functions are not descriptive enough for what their action do or too general, for example:

_Word -> _GetWord

_Words -> _WordCount or _WordCnt or NumWords

_WordIndex -> _WordPos(ition) or _WordLoc(ation)

_Strip -> _StripSpaces or _RmSpaces (Rm-short for Remove) or _StripChar(acter)

_Copies -> _Dup(licate)String

_Insert -> Ins(ert)String

_Say -> EmitString or ShowString or ShowStr

4. The _Strip function should allow you to select which character to strip. It would make it more flexable.

5. Only one typo in the Word.AU3 file: _SucWord in the commented area.

Other than the above all the functions work perfectly and your code is clean. :)

I have attached the file with all the changes for you to review..

Cheers.. :

Link to comment
Share on other sites

Well different opinions is nice:

1. I don't get you on this as the html files were all written compleatly with frontpage and I did not made any connections between documents as this was a waste of time if there were no interest for this UDF and I don't know how autoit topics is written if attached to this...

3.descriptive enough - well I can see your point but at the same time I feel that some of Autoit functions are just wild overdressed with characters to write over and over like _GUICtrlComboGetDroppedControlRect and _GUICtrlListViewGetExtendedListViewStyle etc. and I feel like word() well could be GetWord and Words() well could go for WordCount() - I just translated these functions from another language but I'll wait to hear some other opinions before I change anything other as typos BUT you missed two bugs that I just discovered ( word() & SubWord() functions did not removed the trailing blank characters ) well thanks for the responce...

I'd downloaded your remark file for later investigation - thanks...

kjactive :(

Edited by kjactive
Link to comment
Share on other sites

kjactive,

Regarding the HTML files, If you looked at the examples and cut/Pasted them you would get an error due to a missing parenthesis. So, I am anal on code. : I just thought HTML Related linking just look nice. BTW, I like the ways you did the descriptions and the HTML layout. :) Don't really see people take the time to do that kind of documentation.

As far as the text length of the function name, I like to keep them short, hence simple descriptive names. Glad you found the missed bugs. It is sometimes hard to tell if spaces are moved in just a displayed msgbox. You would have to put quotes or color to know that they were or weren't there.

So anyone who is reading this, please comment.. Need more input.. :(

Great work and thanks for your comments..

Cheers... :(

Link to comment
Share on other sites

I wouls like to hear other 'autoitters' about change function names like Bysysignal suggested to my word UDF library...

3. The names of some of your functions are not descriptive enough for what their action do or too general, for example:

_Word -> _GetWord

_Words -> _NumWords

_WordIndex -> _WordPos()

_Strip -> _StripSpace

_Copies -> _DupString

_Insert -> _InString

_DelWords

_SubWords

_DelString

_Say Well I don't know about this one as this is just a quick consolewrite and I like to write _say as a quick one...

4. The _Strip function should allow you to select which character to strip. It would make it more flexabable - well I don't know here as all these functions is word related no matter and StringReplace could do one of the functions just as well or even quicker as it's buildin function...

But the 6 first suggestions I can see the that they point more directly to what these functions actually do and has the same syntax as the rest of the functions...

Any comments...

kjactive :(

Edited by kjactive
Link to comment
Share on other sites

my own UDF to count words seems to be alot faster

Func _CountWords($s_Sen)
    If StringLen($s_Sen) = 0 Then Return 0
    $s_Sen = StringSplit($s_Sen, ' ')
    Return $s_Sen[0]
EndFunc

My UDF's:;mem stuff_Mem;ftp stuff_FTP ( OLD );inet stuff_INetGetSource ( OLD )_INetGetImage _INetBrowse ( Collection )_EncodeUrl_NetStat_Google;random stuff_iPixelSearch_DiceRoll

Link to comment
Share on other sites

well that's because your function do not return amound of words but only count words with char 0x20 inbetween and that is not the same as to count words in a string - all my UDF functions handle words no matter what sepparated them, a little more to do...

kjactive :(

Edited by kjactive
Link to comment
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
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...