Schal330@lemmy.world to Programmer Humor@programming.dev · 3 months agoIt must be a silent Rlemmy.worldimagemessage-square119fedilinkarrow-up11arrow-down10
arrow-up11arrow-down1imageIt must be a silent Rlemmy.worldSchal330@lemmy.world to Programmer Humor@programming.dev · 3 months agomessage-square119fedilink
minus-squarecypherix93@lemmy.worldlinkfedilinkEnglisharrow-up0·3 months ago"strawberry".split('').filter(c => c === 'r').length
minus-squareSpaceNoodle@lemmy.worldlinkfedilinkarrow-up0·3 months agolen([c if c == ‘r’ for c in “strawberry”])
minus-squareMrLLM@ani.sociallinkfedilinkEnglisharrow-up0·3 months agoimport re; r = [c for c in re.findall("r", "strawberry")]; r = "".join(r); len(r)
minus-squareTiefling IRL@lemmy.blahaj.zonelinkfedilinkarrow-up0·3 months ago'strawberry'.match(/r/ig).length
minus-squareanti-idpol action@programming.devlinkfedilinkarrow-up0·3 months ago(\r (frequencies “strawberry”))
minus-squareAwkwardLookMonkeyPuppet@lemmy.worldlinkfedilinkEnglisharrow-up0·3 months 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·3 months 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 ;)