Code Explainers
Code explainers tagged #escaping
rust
pub fn extract_quoted_fields(line: &str) -> Vec<String> { let mut fields = Vec::new(); let mut current = String::new(); let mut in_quotes = false;
Parsing quoted fields with a state machine in Rust
state-machine
parsing
string-processing
Intermediate
7 steps
ruby
module WifiQrCode ESCAPE_CHARS = /([\\;,:"])/.freeze AUTH_TYPES = {
Building a Wi-Fi QR code payload in Ruby
string-formatting
validation
escaping
Intermediate
9 steps
ruby
require "securerandom" require "time" class ICalEvent
Building an iCalendar file in Ruby
serialization
string-formatting
file-formats
Intermediate
10 steps
php
<?php namespace App\Services;
Building a valid iCalendar feed in PHP in Laravel
ical
serialization
formatting
Intermediate
8 steps
typescript
type CsvColumn<T> = { header: string; value: (row: T) => string | number | boolean | null | undefined; };
Building a type-safe CSV writer in TypeScript
generics
serialization
escaping
Intermediate
7 steps
typescript
type MatchSegment = { text: string; matched: boolean; };
Splitting text into highlighted match segments
regex
string-matching
text-highlighting
Intermediate
8 steps
typescript
type CsvRecord = Record<string, string>; function parseCsv(input: string): CsvRecord[] { const rows: string[][] = [];
Parsing CSV with a character state machine
state-machine
parsing
string-processing
Intermediate
8 steps
javascript
const ESCAPE_MAP = { '&': '&', '<': '<', '>': '>',
Escaping HTML before injecting user content
xss-prevention
escaping
dom
Intermediate
6 steps
php
<?php namespace App\View;
Building a safe HTML escaper in PHP
security
xss
escaping
Intermediate
6 steps