Case insensitive CountString

Got an idea for enhancing PureBasic? New command(s) you'd like to see?
User avatar
spikey
Enthusiast
Enthusiast
Posts: 788
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Case insensitive CountString

Post by spikey »

Could CountString get the same Mode parameter as FindString please?
Help wrote:#PB_String_CaseSensitive: case sensitive search (a=a) (default).
#PB_String_NoCase : case insensitive search (A=a).
I currently have to have two copies of a string around for counting, original case and lower case.
User avatar
TI-994A
Addict
Addict
Posts: 2764
Joined: Sat Feb 19, 2011 3:47 am
Location: Singapore
Contact:

Re: Case insensitive CountString

Post by TI-994A »

spikey wrote: Wed Dec 03, 2025 5:25 pm Could CountString get the same Mode parameter as FindString please?
Help wrote:#PB_String_CaseSensitive: case sensitive search (a=a) (default).
#PB_String_NoCase : case insensitive search (A=a).
I currently have to have two copies of a string around for counting, original case and lower case.


In the meantime, this works without any duplication:

Code: Select all

Debug CountString(UCase("How many 'ow' contains Bow ?"), "OW") ; will display 3
Texas Instruments TI-99/4A Home Computer: the first home computer with a 16bit processor, crammed into an 8bit architecture. Great hardware - Poor design - Wonderful BASIC engine. And it could talk too! Please visit my YouTube Channel :D
User avatar
spikey
Enthusiast
Enthusiast
Posts: 788
Joined: Wed Sep 22, 2010 1:17 pm
Location: United Kingdom

Re: Case insensitive CountString

Post by spikey »

Of course, but it's an optimisation that it would be nice to have available and makes the two commands consistent.
Post Reply