Question bank › Strings
Dsa Strings Warm-up

Extract Digits from String

Write a function to extract all digits from a given string and form a new string containing just those digits in the order they appeared. The input will be a single line string. The output should be a string of digits. If no digits are found, return an empty string. Example input: abc123xyz456 Example output: 123456

Key concepts

stringsdigitsextraction

Practise this out loud — free

Start a mock interview on THIS exact question — a voice AI interviewer opens with it, pushes back like a real onsite, then hands you an instant scorecard.

🎙 Practise this question now
Part of Praxari's verified interview question bank. We show the prompt and concepts to practise with — never a copy-paste solution.