FIND YOUR NEXT FEW LINES

Results for “Text validation & parsing”

Small, practical examples. Search by task or narrow things down below.

547 snippets foundClear filters
JavaText validation & formatting

Treat dynamic regex input as literal text

Java: Use Pattern.quote so metacharacters in a search term lose their special meaning.

Java✓ Tested
GoErrors & validation

Wrap an error with context

Wrap an error with context using a complete Go program with explicit sample inputs.

Go✓ Tested
PythonText validation & encoding

Build a URL query string

Python: Use urlencode to percent-encode query parameter values correctly.

Python✓ Tested
JavaText validation & formatting

Check a filename suffix

Java: Use endsWith for a case-sensitive literal suffix test.

Java✓ Tested
C#Text validation & encoding

Check a literal prefix with ordinal comparison

C#: Choose StringComparison.Ordinal when a prefix is a protocol token rather than culture-dependent text.

C#✓ Tested
JavaText validation & formatting

Check a string prefix

Java: Use startsWith to check a literal Java prefix without a regular expression.

Java✓ Tested
C#Text validation & encoding

Check an extension without case sensitivity

C#: Use an explicit ordinal case-insensitive comparison for a known filename suffix.

C#✓ Tested
Bash ScriptsText parsing & arithmetic

Clamp a numeric setting to a valid range

Bash Scripts: Use arithmetic comparisons before applying a user-supplied bounded setting.

Bash Scripts✓ Tested
JavaText validation & formatting

Count Unicode code points

Java: Use codePointCount when supplementary characters should count as one rather than two UTF-16 units.

Java✓ Tested
PythonText validation & encoding

Encode and decode binary data as Base64

Python: Use Base64 when a text format must carry bytes; it is encoding, not encryption.

Python✓ Tested
C#Text validation & encoding

Enumerate Unicode code points

C#: EnumerateRunes combines surrogate pairs into Unicode scalar values.

C#✓ Tested
C#Text validation & encoding

Extract a substring with range syntax

C#: C# range ends are exclusive; indices operate on UTF-16 code units.

C#✓ Tested