MCPcopy
hub / github.com/claude-code-best/claude-code / countCharInString

Function countCharInString

src/utils/stringUtils.ts:54–66  ·  view source on GitHub ↗
(
  str: { indexOf(search: string, start?: number): number },
  char: string,
  start = 0,
)

Source from the content-addressed store, hash-verified

52 * (Buffer.indexOf accepts string needles).
53 */
54export function countCharInString(
55 str: { indexOf(search: string, start?: number): number },
56 char: string,
57 start = 0,
58): number {
59 let count = 0
60 let i = str.indexOf(char, start)
61 while (i !== -1) {
62 count++
63 i = str.indexOf(char, i + 1)
64 }
65 return count
66}
67
68/**
69 * Normalize full-width (zenkaku) digits to half-width digits.

Callers 15

renderToolResultMessageFunction · 0.85
getSnippetForTwoFileDiffFunction · 0.85
TaskOutputResultDisplayFunction · 0.85
formatOutputFunction · 0.85
UserPromptMessageFunction · 0.85
generateFileAttachmentFunction · 0.85
ripGrepFileCountFunction · 0.85
extractToolStatsFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected