도구 가이드
Developer 무료 회원가입 불필요

String Manipulation Toolkit

Pad, trim, repeat, replace, wrap, escape, and extract substrings — all in one place.

도구를 불러오는 중…

이 도구에 대해

A one-stop developer toolkit for common string operations that are easy to forget the exact syntax for. Each operation lives in its own mini-card with its own input and instant output. Pad strings left or right to a given length; trim whitespace from either or both ends; repeat a string N times; split on a delimiter and rejoin with a different one; replace the first or all occurrences with optional case-insensitive matching; truncate with a custom ellipsis; word-wrap at N characters; escape and unescape for JS string literals, JSON, regular expressions, SQL LIKE patterns, and HTML entities; count how many times a substring occurs; and extract substrings that appear before, after, or between two delimiter strings.

사용 방법

  1. 1 Find the operation card you need — Pad, Trim, Repeat, Split/Join, Replace, Truncate, Word Wrap, Escape/Unescape, Count, or Extract.
  2. 2 Type your input string and set any parameters (length, pad character, delimiter, etc.).
  3. 3 The output updates instantly in the card's result box.
  4. 4 Click the copy icon next to any result to copy it to the clipboard.
  5. 5 Use the search box at the top to filter cards by operation name.

One workbench for the string operations you keep forgetting

Every developer knows what they want to do to a string — pad it, trim it, escape it, pull a value out of the middle — but few remember the exact syntax for all of them. This toolkit puts ten common operations on a single page, each in its own self-contained card with its own inputs and a live result that updates the moment you type. There's no "run" button to hunt for and no mode-switching: every card recalculates on each keystroke. A filter box at the top lets you narrow to the one operation you need by typing part of its name, like escape or trim.

The ten operations are Pad, Trim, Repeat, Split & Join, Replace, Truncate, Word Wrap, Escape / Unescape, Count Occurrences, and Extract Substring. Each maps to a real, well-defined transformation, and a copy button on every result gets the output onto your clipboard in one click.

What each operation does

  • Pad — extend a string to a target length by adding a fill character on the left (padStart) or right (padEnd). The classic use is zero-padding numbers: 5 becomes 0005.
  • Trim — remove whitespace from both ends, the left only, or the right only. The result is shown JSON-quoted so you can see exactly where the string now starts and ends.
  • Repeat — duplicate a string N times (capped at 200 to stay safe).
  • Split & Join — break on one delimiter and rejoin with another, e.g. turn apple,banana,cherry into apple | banana | cherry.
  • Replace — swap text, with checkboxes for replace-all and case-insensitive matching. It escapes regex metacharacters first, so a literal . or $ in your search term is treated literally, not as a pattern.
  • Truncate — cut a string to a maximum length and append an ellipsis, accounting for the ellipsis width so the total stays within the limit.
  • Word Wrap — reflow text to a column width without breaking words mid-letter.
  • Escape / Unescape — covered in its own section below.
  • Count Occurrences — count non-overlapping appearances of a substring, optionally case-insensitive.
  • Extract Substring — pull the text before, after, or between delimiter strings.

The Escape tool: seven modes that prevent real bugs

The escape card is the most valuable for working developers because escaping mistakes cause genuine, hard-to-spot bugs. It offers seven modes: JS string escape/unescape, JSON escape, regex literal escape, SQL LIKE escape, and HTML entity escape/unescape. Each targets a different context. Regex escaping turns characters like ., *, and ( into their backslash-escaped forms so a user-supplied string can be safely dropped into a pattern. SQL LIKE escaping doubles single quotes and escapes the % and _ wildcards. HTML escaping converts <, >, and & into entities — the front-line defence against breaking your markup or opening an injection hole.

A worked example: Extract Substring

Suppose you have the string Hello [world] goodbye [earth] and you want what's inside the first pair of brackets. In the Extract card, set the mode to Between, the start delimiter to [, and the end delimiter to ]. The tool finds the first [, then the next ] after it, and returns everything in between: world. Switch the mode to After with delimiter goodbye and it returns [earth] — everything following the first match. This is the fast way to peel a token out of a log line, a filename, or a templated string without writing a regex.

Common use cases

  • Cleaning pasted data — trimming stray whitespace and padding ID numbers to a fixed width before importing a CSV.
  • Preparing user input for code — escaping a search term so it's safe inside a regex, a SQL query, or HTML output.
  • Reformatting lists — splitting a comma-separated string and rejoining it with newlines or pipes.
  • Generating test fixtures — repeating a string or truncating long sample text to a uniform length.
  • Quick parsing — extracting the value between two known markers without opening an editor.

Tips and common mistakes

  • Use JSON escape, not JS escape, for config files. The two are close but not identical — JSON has stricter rules around quotes and control characters. Pick the mode that matches where the string will land.
  • Trim shows quotes on purpose. The JSON-wrapped output is a feature: it makes leading or trailing spaces visible so you can confirm the trim did what you expected.
  • Replace escapes your search term literally. Because metacharacters are escaped before matching, you can paste text containing ( or ? as a plain find target without it being interpreted as a regex.
  • Count is non-overlapping. Searching for aa in aaaa returns 2, not 3, because each match advances past the characters it consumed.
  • The filter box doesn't clear your inputs of other cards. Filtering re-renders the visible set; type the operation name to jump straight to it instead of scrolling.

자주 묻는 질문

{# Alpine.js — self-hosted. (The previous jsdelivr CDN tag had a stale SRI integrity hash, so the browser refused to run it and window.Alpine was never defined — silently breaking every FAQ accordion and Alpine tool.) #}