July 2008

Python-style startswith and endswith string functions in Javascript

The Python language has useful string methods to search for prefixes and suffixes:


my_string.startswith('pre')

The same thing can be achieved in Javascript using the rather powerful search and replace methods.

Continue Reading »

Uncategorized

Comments (1)

Permalink

Using JQuery and Javascript to parse XML to objects

Right - thought I’d post some actual code as proof of actual development.

I wrote the first version of my CMS back-end in PHP, and sent data to a Javascript front-end using JSON. This was fantastically fast and simple - the string only need be checked for dangerous syntax, and then eval-ed and it becomes Javascript objects ready to use. The pot-noodle of data formats.

Continue Reading »

Uncategorized

Comments (0)

Permalink