Skip to content

Productivity Quote by Douglas Crockford

“suppress empty strings in the output array when the separator is a regular expression: var f = '|a|b|c|'.split(/\|/); // f is ['a', 'b', 'c'] on some systems, and // f is ['', 'a', 'b', 'c', ''] on others string.substring(start, end ) The substring method is the same as the slice method except…” quote by Douglas Crockford
Download Open image
““suppress empty strings in the output array when the separator is a regular expression: var f = '|a|b|c|'.split(/\|/); // f is ['a', 'b', 'c'] on some systems, and // f is ['', 'a', 'b', 'c', ''] on others string.substring(start, end ) The substring method is the same as the slice method except that it doesn’t handle the adjustment for negative parameters. There is no reason to use the substring method. Use slice instead. string.toLocaleLowerCase( ) The toLocaleLowerCase method produces a new string that is made by converting this string to lowercase using the rules for the locale. This is primarily for the benefit of Turkish because in that language 'I’ converts to 1””

Douglas Crockford

About This Quote

The quote discusses best practices for string handling in programming, emphasizing consistent splitting, preferring slice over substring, and locale-aware case conversion.

In simple terms: Use reliable string methods and locale-aware case conversion.

Key Takeaway

Prefer slice, handle empty splits, respect locale.

Themes

programming best practices string handling

Mood

technical informative

Type

advice instructional

When to use this quote

  • data parsing
  • internationalization
  • code portability

Key Concepts

splitting slice vs substring locale case conversion

Questions to Reflect On

  • How do you ensure consistent split results?
  • When should you choose slice over substring?
A Different Perspective

Neglecting locale can cause bugs in Turkish text.

2.4 out of 5 (10 ratings)

More by Douglas Crockford

Explore all 33 Douglas Crockford quotes

More Productivity quotes

Browse all 3,421 Productivity quotes