# Developer Text Utilities Cheatsheet: Counts and Case

2026-05-01

https://toolblip.com/blog/text-utilities-cheatsheet-developers

Every developer works with text. Strings, payloads, code snippets, UI copy, log output  -  it is all text. And yet most developers end up writing one-off scripts to do things a good text utility could handle in milliseconds.

This cheatsheet covers the five text utilities you will reach for repeatedly: word counter, character counter, case converter, text sorter, and readability scorer. Bookmark it. Share it with your team.

## Word Counter  -  `/tools/word-counter`

Counting words sounds trivial until you are writing API documentation, a changelog, or a pull request description with a strict word limit.

```javascript
// Native approach
const text = "The quick brown fox jumps over the lazy dog.";
const wordCount = text.trim().split(/\s+/).length;
// → 9

// With punctuation stripped
const cleanText = text.replace(/[^\w\s]/g, '');
const cleanWordCount = cleanText.trim().split(/\s+/).length;
// → 9 (punctuation was not a word)
```

**Common use cases:**
- Documentation with word count requirements
- Abstract submissions with upper limits
- Code comment length checks in code reviews
- SEO meta description length (characters, not words  -  see below)

**Quick reference:**

| Metric | Example |
|---|---|
| Words | `text.split(/\s+/).filter(Boolean).length` |
| Unique words | `new Set(text.toLowerCase().match(/\b\w+\b/g)).size` |
| Sentences | `text.split(/[.!?]+/).filter(Boolean).length` |
| Paragraphs | `text.split(/\n\n+/).filter(Boolean).length` |

For a full breakdown  -  word count, sentence count, paragraph count, and reading time estimate  -  use [Toolblip's Word Counter](/tools/word-counter). No signup, no upload, everything runs in your browser.

## Character Counter  -  `/tools/character-counter`

Character count matters in places developers often forget: Twitter (280), SMS (160), database column limits, URL length constraints, and UI components with fixed-width labels.

```javascript
const text = "Hello, world!";

// With spaces
text.length;
// → 13

// Without spaces
text.replace(/\s/g, '').length;
// → 11

// Unicode-safe (accounts for emoji, CJK chars)
[...text].length;
// → 13 (same here, but matters for multi-byte chars)

const tweet = "Just shipped a new feature! 🚀";
tweet.length;          // → 30 (UTF-16 code units)
[...tweet].length;     // → 29 (Unicode code points; the emoji uses 2 UTF-16 units)
```

**Where character limits bite you:**

| Context | Typical Limit | Notes |
|---|---|---|
| X ordinary post | 280 weighted characters | URLs count as 23; emoji sequences count as 2 per X rules |
| SMS segment | 160 chars | UCS-2 encoding |
| URL query string | ~2000 | Browser/server dependent |
| Database VARCHAR | Varies | Check your schema |
| UI label | Design-dependent | Test with real content |

[Toolblip's Character Counter](/tools/character-counter) shows total characters, counts without spaces or newlines, letters, and digits. For X’s weighted count, check its composer.

## Case Converter  -  `/tools/case-converter`

Changing text case is constant  -  converting API responses to camelCase, snake_case for database columns, kebab-case for CSS classes, CONSTANT_CASE for config files.

```javascript
const text = "hello_world";

// camelCase: first word lowercase, rest capitalized
const camel = text.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
// → "helloWorld"

// PascalCase: every word capitalized
const pascal = text
  .split('_')
  .map(w => w.charAt(0).toUpperCase() + w.slice(1))
  .join('');
// → "HelloWorld"

// kebab-case: replace underscores with hyphens
const kebab = text.replace(/_/g, '-');
// → "hello-world"

// snake_case: already here, but invert kebab to snake
const snake = kebab.replace(/-/g, '_');
// → "hello_world"

// CONSTANT_CASE: uppercase with underscores
const constant = text.toUpperCase();
// → "HELLO_WORLD"

// Train-Case: capitalize words, hyphen-separated
const train = text
  .split('_')
  .map(w => w.charAt(0).toUpperCase() + w.slice(1))
  .join('-');
// → "Hello-World"
```

**When you need it in real code:**

```javascript
// Converting API response keys to camelCase (recursively)
function toCamelCase(str) {
  return str.replace(/_([a-z])/g, (_, c) => c.toUpperCase());
}

function keysToCamel(obj) {
  if (Array.isArray(obj)) return obj.map(keysToCamel);
  if (obj && typeof obj === 'object') {
    return Object.fromEntries(
      Object.entries(obj).map(([k, v]) => [
        toCamel(k),
        keysToCamel(v)
      ])
    );
  }
  return obj;
}

keysToCamel({ user_name: "Alice", user_address: { zip_code: "10001" } });
// → { userName: "Alice", userAddress: { zipCode: "10001" } }
```

For instant conversions without writing helper functions, use [Toolblip's Case Converter](/tools/case-converter). Handles camelCase, PascalCase, snake_case, kebab-case, CONSTANT_CASE, and more in a single interface.

## Text Sorter  -  `/tools/text-line-sorter`

Sorting lines of text comes up more often than you expect: organizing import statements, sorting a list of environment variable names, arranging feature flags, deduplicating and ordering a list.

```javascript
const lines = [
  "zebra",
  "apple",
  "mango",
  "banana"
];

// Alphabetical (A-Z)
lines.sort();
// → ["apple", "banana", "mango", "zebra"]

// Reverse alphabetical (Z-A)
lines.sort().reverse();
// → ["zebra", "mango", "banana", "apple"]

// Case-insensitive sort
lines.sort((a, b) => a.localeCompare(b));
// → ["apple", "banana", "mango", "zebra"]

// Numeric sort (when lines contain numbers)
const versions = ["v1.10", "v1.2", "v1.9", "v2.0"];
versions.sort((a, b) => a.localeCompare(b, undefined, { numeric: true }));
// → ["v1.2", "v1.9", "v1.10", "v2.0"]

// Randomize (Fisher-Yates shuffle)
function shuffle(arr) {
  const a = [...arr];
  for (let i = a.length - 1; i > 0; i--) {
    const j = Math.floor(Math.random() * (i + 1));
    [a[i], a[j]] = [a[j], a[i]];
  }
  return a;
}
```

**Sorting lines vs. sorting arrays**  -  in JavaScript, `Array.sort()` sorts alphabetically by default, which can produce unexpected results with numbers:

```javascript
// Default sort (string comparison)
[1, 10, 2].sort();
// → [1, 10, 2]  ← "10" comes before "2" alphabetically!

// Numeric sort
[1, 10, 2].sort((a, b) => a - b);
// → [1, 2, 10]  ← correct
```

[Toolblip's Text Sorter](/tools/text-line-sorter) handles alphabetical, reverse, case-insensitive, numeric, and random sort  -  plus remove duplicate lines in one click.

## Readability Score  -  `/tools/readability-score`

Readability scores estimate how easy your text is to read based on sentence length, syllable count, and word complexity. If you write docs, error messages, API descriptions, or any user-facing copy, these scores help you catch when your writing gets too dense.

```javascript
// Flesch Reading Ease (0–100, higher = easier)
// Formula simplified for estimation:
function fleschReadingEase(text) {
  const sentences = text.split(/[.!?]+/).filter(Boolean);
  const words = text.split(/\s+/).filter(Boolean);
  const syllables = words.reduce((sum, w) => sum + countSyllables(w), 0);

  if (!sentences.length || !words.length) return 0;

  const avgWordsPerSentence = words.length / sentences.length;
  const avgSyllablesPerWord = syllables / words.length;

  // Classic Flesch formula
  return 206.835 - (1.015 * avgWordsPerSentence) - (84.6 * avgSyllablesPerWord);
}

function countSyllables(word) {
  word = word.toLowerCase().replace(/[^a-z]/g, '');
  if (!word.length) return 0;
  // Rough heuristic: vowel groups = syllables
  const vowelGroups = word.match(/[aeiouy]+/g);
  if (!vowelGroups) return 1;
  // Subtract silent 'e' at end
  let count = vowelGroups.length;
  if (word.endsWith('e') && count > 1) count--;
  return count;
}

fleschReadingEase("The quick brown fox jumps over the lazy dog.");
// → 94.3 with this rough syllable helper
```

**Score interpretation (Flesch Reading Ease):**

| Score | Readability | Example |
|---|---|---|
| 90–100 | Very easy | Children's books |
| 80–89 | Easy | Simple content |
| 70–79 | Fairly easy | Conversational |
| 60–69 | Standard | General writing |
| 50–59 | Fairly difficult | Professional |
| 30–49 | Difficult | Academic |
| 0–29 | Very difficult | Legal/technical |

For user-facing developer content (docs, README, error messages), aim for 60–80. For internal technical docs, 50–70 is fine.

[Toolblip's Readability Score](/tools/readability-score) gives you Flesch Reading Ease, Flesch-Kincaid Grade Level, and a syllable count breakdown  -  all in-browser.

## Quick Reference Table

| Utility | What it measures | Best tool |
|---|---|---|
| [Word Counter](/tools/word-counter) | Word, sentence, paragraph count | In-browser, instant |
| [Character Counter](/tools/character-counter) | Characters with/without spaces, letters, digits | In-browser, instant |
| [Case Converter](/tools/case-converter) | camelCase, snake_case, kebab-case, etc. | In-browser, instant |
| [Text Sorter](/tools/text-line-sorter) | Sort, reverse, randomize, deduplicate lines | In-browser, instant |
| [Readability Score](/tools/readability-score) | Flesch scores, grade level, syllable count | In-browser, instant |

All five tools run entirely in your browser. The text operations run locally  -  which matters when you are working with proprietary copy, internal documentation, or anything you would rather not upload.

## Put It Together

These utilities shine when chained together:

1. Paste draft documentation into [Character Counter](/tools/character-counter) to count characters. It does not apply a meta-description or social-network preset.
2. Run it through [Readability Score](/tools/readability-score) to catch over-complex sentences
3. Use [Case Converter](/tools/case-converter) to standardize terminology
4. Sort with [Text Sorter](/tools/text-line-sorter) and deduplicate a list of terms
5. Check final word count with [Word Counter](/tools/word-counter)

None of these require a signup. Open the tab once, keep it in your toolbar, and reach for it the next time you need to quickly count, convert, sort, or score text.
