Enter text, choose an operation, and see what the language actually does.
No account needed. Text stays in browser memory: no uploads, saved inputs, or share links. Python loads only when you run it.
Try this example
Trimming " Café 😀, café " produces "Café 😀, café" in both languages. Python uses text.strip(); JavaScript uses text.trim(). Then compare length or slice: JavaScript counts the emoji as two UTF-16 units.
What each operation means
Length
Count Unicode code points in Python or UTF-16 code units in JavaScript. An emoji can occupy two JavaScript units; neither count measures visible grapheme clusters.
Keep learning: Python: Python’s string model · JavaScript: JavaScript’s string model
Slice
Choose a start index and optional exclusive end. Negative indices count from the end. Python slices use code points; JavaScript slices use UTF-16 units.
Keep learning: Python: Python’s string model · Python: Indexing and slicing · JavaScript: JavaScript’s string model · JavaScript: Slicing, searching, and replacement
Trim whitespace
Remove surrounding whitespace with Python strip() or JavaScript trim(). Internal whitespace stays. Their definitions of whitespace differ for some Unicode characters.
Keep learning: Python: Python’s string model · JavaScript: JavaScript’s string model · Python: Cleaning whitespace and normalizing text safely
Split
Python without a separator splits on whitespace and removes empty fields. JavaScript without a separator returns the whole string in an array. An explicit empty separator fails in Python but splits UTF-16 units in JavaScript.
Keep learning: Python: Python’s string model · JavaScript: JavaScript’s string model · Python: Cleaning whitespace and normalizing text safely
Replace all matches
Search is literal, not a regular expression. Python replacement text is literal. JavaScript replaceAll interprets replacement tokens such as $$ (dollar), $& (match), $` (prefix), and $' (suffix).
Keep learning: Python: Python’s string model · JavaScript: JavaScript’s string model · Python: Cleaning whitespace and normalizing text safely
Lowercase
Convert text to lowercase using the selected language’s Unicode rules. Some characters expand; these methods are not locale-aware language collation.
Keep learning: Python: Python’s string model · JavaScript: JavaScript’s string model · Python: Cleaning whitespace and normalizing text safely
Uppercase
Convert text to uppercase. For example, ß becomes SS. Case conversion can change the number of characters.
Keep learning: Python: Python’s string model · JavaScript: JavaScript’s string model · Python: Cleaning whitespace and normalizing text safely
Find text
Return the first matching index, or -1 if absent. Python returns a code-point index; JavaScript returns a UTF-16 index. Empty search text matches at index 0.
Keep learning: Python: Python’s string model · JavaScript: JavaScript’s string model
Results are limited to 100,000 characters. Lists show their first 100 items; index views show their first 128 units. Search is literal and case-sensitive.
Free Python practice · Free JavaScript practice · Explore courses