Input Parsing - rFronteddu/general_wiki GitHub Wiki
- Tokenization (Split & Parse)
- Line-By-Line Parsing
- Unkn Line Count
- Filtering Garbage
- Extracting Numbers from text
- Handling Quoted Strings
- Normalize Case + White Space
- Parsing Dates and Time
- Parsing Nested Data
- Robust Handling
Drills:
How to Practice This Efficiently
- Daily (15–25 min):
- Pick 2 drills
- Write parser in your interview language
- Add 3 edge cases
- Time yourself (10 min limit)
- Refactor to cleaner version
Clean Number List
Input:
" 1, 2, abc, -3, 4x, 5 "
Return [1, 2, -3, 5]
Command Parser
Input:
ADD 12
SUB 3
MUL 7
DIV two
ADD 5
Goal: Ignore invalid commands, compute final value
CSV Reader
Input:
Bob,25,"New York, USA"
Alice, 30, "LA"
Goal: Parse into structured records
Log Scanner
Input:
[INFO] 2026-01-21 User=123 Action=Login
[ERROR] 2026-01-21 User=abc Action=Logout
Goal: Extract only valid numeric user IDs
Bracketed List Parser
Input
"[1,[2,3],[],[4,[5]]]"
Goal: Build nested lists
Streaming Integers
Input:
1 2 3
4 five 6
7 8 nine
Goal: Sum only valid integers