Jump to content

Spaces and StringIsLower


Recommended Posts

Hi,

I want to use StringIsLower to check if a string contains only lower case letters, but of the string contains all lower case letters and a space, the function returns False.

Is this normal behaviour?

My code:

$SourceX = StringStripWS($SourceX , 7)
if StringIsLower($SourceX) = 1 then
    MsgBox(0, "TEST", "All lower case")
endif

If $SourceX = "abcde" this works fine, but if $SourceX = "ab de", it is not considered all lower case.

I have also tried:

$SourceX = StringStripWS($SourceX , 7)   
if StringLower($SourceX) = $SourceX then
        MsgBox(0, "TEST", "All lower case")
endif

But this doesn't work either.

Is there a simple solution that I overlook?

Bart

Link to comment
Share on other sites

$SourceX = "abcd qfs"
If StringIsLower(StringStripWS($SourceX,8)) Then
MsgBox(0, "Test", "All lower case letters")
EndIf

You dont have to have If StringIsLower = 1, just say, "If StringIsLower Then", because the If statement will handle the boolean answer. Similarly, If NOT StringIsLower Then will check if it isnt lowercase.

Also, combined two of your lines into one.

Edited by Simucal
AutoIt Scripts:Aimbot: Proof of Concept - PixelSearching Aimbot with several search/autoshoot/lock-on techniques.Sliding Toolbar - Add a nice Sliding Toolbar to your next script. Click the link to see an animation of it in action!FontInfo UDF - Get list of system fonts, or search to see if a particular font is installed.Get Extended Property UDF - Retrieve a files extended properties (e.g., video/image dimensions, file version, bitrate of song/video, etc)
Link to comment
Share on other sites

Understood JdeB. I slipped there! :"> , StringStripWS :wacko:

Is this normal behaviour?

The difference between 7 & 8 is that 7 will remove double spaces or more where as 8 will remove all spaces.

Edit:

Ok, oh forum would be nice with autocomplete, like Scite4AutoIt3 has... :D for my sake atleast.

Edited by MHz
Link to comment
Share on other sites

Thank you all!

This works great:

$SourceX= StringStripWS($SourceX, 7)   
If StringIsLower(StringStripWS($SourceX, 8)) Then
        MsgBox(0, "TEST", "All lower case")
endif

(I still need both versions (7 & 8) because of further operations on the string after the test.)

Bart

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...