Jump to content

[UDF] Some more string management routines


Recommended Posts

Here is an other UDF for string handling :

Date handling

_StringDateConvert:  convert a date from one format ("YMD", "MDY" or "DMY") to another.

_StringIsDate:  checks if a date with a given format is valid

String management

_StringCount: count of occurrences that appear in a string

_StringFormatBytesSize: formatting a dimension expressed in bytes (bytes) in MB, TB, ...)

_StringIsEndingWith: check if a string end with some characters

_StringIsStartingWith: check if a string start with some characters

_StringJoinArray:  concatenate elements of an array to rebuild a string

_StringPadLeft: filling a string with characters on the left

_StringPadRight: fill a string with characters on the right

_StringRemoveFrenchAccent: remove french accent

_StringRemoveChars: deleting characters from a string

_StringStrip: eliminate characters at the begin and/or at the  end of a string

_StringTitleCaseFrench: capitalize the first letter of each word with elimination of french accents

_StringWSClean: simple replacement of "White Spaces",  remove beginning and trailing spaces and multiple spaces removal

Any comments, suggestions for improvement or constructive criticism are welcome.

Below you will find the UDF and a demo program. 




Edited by Jeep
Unvaluable fonction has been removed
Link to comment
Share on other sites

This is awesome... I like the encryption part... what standard is the encryption method? AES 128, 192 or 256 bits?

Edited by Skeletor

Kind Regards

"Coffee: my defense against going postal."

Microsoft Office Splash Screen | Basic Notepad Program (Beginner) | Transparent Splash Screen | Full Screen UI

Link to comment
Share on other sites

Dear Skeletor,

Encryption method are one of the method supported by _Crypt_EncryptData (see _Crypt_DeriveKey : creates a key from algorithm and password) :

The constants are defined in "#include <Crypt.au3>"

$CALG_AES_128     128 bits
$CALG_AES_192     192 bits
$CALG_AES_256        256 bits
$CALG_DES     56 bits
$CALG_3DES     168 bits
$CALG_RC2     128 bits
$CALG_RC4     128 bits

You may use these  constants as the value supplied for $iAlgorithm parameter in StringEncrypt and StringDecrypt. The default is $CALG_RC4. Use the same value in the two functions if you would like to receive the correct result :-).

Edited by Jeep
Link to comment
Share on other sites

Hello Skeletor, 

That's exactly what the function do: simplify the use of basic function already implemented in AutoIt. I've  spend few hours playing with all the basic Crypt functions and it's my result how to do simply the job.



Link to comment
Share on other sites

  • Moderators
3 hours ago, Jeep said:

Hello Skeletor, 

That's exactly what the function do: simplify the use of basic function already implemented in AutoIt. 

Care to expand on this? I guess I am wondering at why someone would use your _StringBetween2 function, for example, when there is already a _StringBetween (as noted yourself in your comments). What does your function do that the native function does not? Same with _StringAppend, you take a one-line snippet and expand it into a whole function - is there really a need to pad it like that?

I'm all for new folks learning the language and trying new things, but the Examples forum is intended to be a showcase for "cool scripts". If what you are doing is simply adding another wrapper around an existing function, without significantly changing one of its properties (fewer lines, better error checking, faster run time, etc. etc. etc.) is there really any benefit? And if your functions do meet those criteria you should explain exactly how it does so, so forum members can benefit.

"Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball

How to get your question answered on this forum!

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

  • Create New...