Schal330@lemmy.world to Programmer Humor@programming.dev · 27 days agoIt must be a silent Rlemmy.worldimagemessage-square120fedilinkarrow-up11arrow-down10
arrow-up11arrow-down1imageIt must be a silent Rlemmy.worldSchal330@lemmy.world to Programmer Humor@programming.dev · 27 days agomessage-square120fedilink
minus-squarecypherix93@lemmy.worldlinkfedilinkEnglisharrow-up0·27 days ago"strawberry".split('').filter(c => c === 'r').length
minus-squareSpaceNoodle@lemmy.worldlinkfedilinkarrow-up0·27 days agolen([c if c == ‘r’ for c in “strawberry”])
minus-squareMrLLM@ani.sociallinkfedilinkEnglisharrow-up0·26 days agoimport re; r = [c for c in re.findall("r", "strawberry")]; r = "".join(r); len(r)
minus-squareTiefling IRL@lemmy.blahaj.zonelinkfedilinkarrow-up0·27 days ago'strawberry'.match(/r/ig).length
minus-squareanti-idpol action@programming.devlinkfedilinkarrow-up0·27 days ago(\r (frequencies “strawberry”))
minus-squareAwkwardLookMonkeyPuppet@lemmy.worldlinkfedilinkEnglisharrow-up0·27 days agoAre you implying that it’s running a function on the word and then giving a length value for a zero indexed array?
minus-squareSluyter548@lemmy.worldlinkfedilinkarrow-up0·27 days agoA zero indexed array doesn’t have a different length ;)
"strawberry".split('').filter(c => c === 'r').length
len([c if c == ‘r’ for c in “strawberry”])
import re; r = [c for c in re.findall("r", "strawberry")]; r = "".join(r); len(r)
'strawberry'.match(/r/ig).length
(\r (frequencies “strawberry”))
Are you implying that it’s running a function on the word and then giving a length value for a zero indexed array?
A zero indexed array doesn’t have a different length ;)