Template:Count

From Ring of Brodgar
Jump to navigation Jump to search
Template documentation (for the template shown above, sometimes hidden or invisible)
  • Simple basic, and limited, character counter. (intended for limited/manual usage)
  • Count occurring cases of a given character in a given string. (returns number [0..max|<empty>])
  • On missing mandatory input(either) defaults to returning an empty string.
  • On hitting the max count returns blank string, or optional third parm string.
  • Uses explode to get the job done. (no other method found at this moment)
    • Due to using explode the count is limited to the number of explodes used. (current max-count is 9 (bugs out at 10 cases))
  • Parm #1: Character to count. (intended for single character usage, but should also work for multiple character strings (not tested))
  • Parm #2: String to process.
  • Example: {{count|,|abc,def,ghi}}
  • Limitation/pitfall: (for specific case usage) Will not strip any leading or trailing search cases from data string.
  • Limitation/pitfall: Will stop counting when it hits an empty/blank-string case. (ie: {{count|,|abc,def, ,ghi}} => 1 instead of 3)

Visit Template:Count/doc to edit this text! (How does this work?)