Counts digits in any number, handling integers, decimals, and scientific notation. Access via MCP in Cursor or Windsurf, or REST at GET /v1/number/count-digits. Returns precise digit counts — useful for validation, formatting, or mathematical analysis. Distinguishes between total digits and digits before/after decimal points.
curl "https://tinyfn.io/v1/number/count-digits" \
-H "X-API-Key: YOUR_API_KEY"
const response = await fetch('https://tinyfn.io/v1/number/count-digits', {
headers: { 'X-API-Key': 'YOUR_API_KEY' }
});
const data = await response.json();
console.log(data);
import requests
response = requests.get('https://tinyfn.io/v1/number/count-digits',
headers={'X-API-Key': 'YOUR_API_KEY'})
data = response.json()
print(data)
Connect your AI agent (Claude, Cursor, Windsurf, etc.) to TinyFn's number tools:
{
"mcpServers": {
"tinyfn-number": {
"url": "https://tinyfn.io/mcp/number",
"headers": {
"X-API-Key": "YOUR_API_KEY"
}
}
}
}
Counts all numeric digits, excluding the decimal point itself. For example, 123.456 returns 6 total digits (3 before decimal, 3 after).
Yes, it processes the coefficient digits only. 1.23e+10 counts as 3 digits from the 1.23 portion, ignoring the exponent formatting.
Absolutely. AI agents can call count-digits to verify numeric inputs meet length requirements before processing, ensuring data validation consistency.
Negative signs are ignored, only digits count. Leading zeros in decimals (like 0.123) are included, so 0.123 has 4 digits total.
Yes, it's number-aware. String length on '123.45' returns 6 (including the dot), while count-digits returns 5 (digits only).
Get your free API key and start using Count Digits in seconds.
Get Free API Key