Bart Posted July 14, 2006 Share Posted July 14, 2006 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 More sharing options...
MHz Posted July 14, 2006 Share Posted July 14, 2006 Use StringStringWS with flag 8 will do it for a check. Link to comment Share on other sites More sharing options...
Simucal Posted July 14, 2006 Share Posted July 14, 2006 (edited) $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 July 14, 2006 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 More sharing options...
Developers Jos Posted July 14, 2006 Developers Share Posted July 14, 2006 Use StringStringWS .... SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
MHz Posted July 14, 2006 Share Posted July 14, 2006 (edited) Understood JdeB. I slipped there! :"> , StringStripWS 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... for my sake atleast. Edited July 14, 2006 by MHz Link to comment Share on other sites More sharing options...
Bart Posted July 14, 2006 Author Share Posted July 14, 2006 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 More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now