Jump to content
Aquablue

Case sensitivity in CountStr

Recommended Posts

I'm using CountStr to compare occurrences of a substring in a string, and noticed that it is case sensitive (for example, CountStr(Derp,Derp) gives 1, while CountStr(Derp,derp) gives 0). Is there any way to disable this sensitivity?

 

Make a modified version of the function that makes every string in both copied to a temp array that runs LowerCase on all of them or just make a new function from scratch that uses LowerCase in the comparison line.

Link to comment
Share on other sites

I'm using CountStr to compare occurrences of a substring in a string, and noticed that it is case sensitive (for example, CountStr(Derp,Derp) gives 1, while CountStr(Derp,derp) gives 0). Is there any way to disable this sensitivity?

 

Not that I can remember, but you could as Wanted suggests, simply lowercase both strings, if case is not important. You could also use the PregMatchEx function to match a regular expression without case sensitivity and get the number of results, but that may be a bit overkill in this case.

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.



×
  • Create New...