Login

Tag "replace"

Snippet List

replace

Small example of how to write your own function. This is not available in Django. The function just replaces static text strings, regular expressions are not supported. The syntax is the same in SQLite, PostgreSQL, MySQL and Oracle.

  • text
  • replace
Read More

Python-like string interpolation in Javascript

Provides python-like string interpolation. It supports value interpolation either by keys of a dictionary or by index of an array. Examples: interpolate("Hello %s.", ["World"]) == "Hello World." interpolate("Hello %(name)s.", {name: "World"}) == "Hello World." interpolate("Hello %%.", {name: "World"}) == "Hello %." This version doesn't do any type checks and doesn't provide formating support.

  • template
  • javascript
  • string interpolation
  • replace
Read More

2 snippets posted so far.