On 05/09/05 11:21 AM CDT, Peter Fein <pfein@xxxxxxxxx> said: > Hiya- > > I'm looking for a function to return the number of words in a string, > split on whitespace. I'm coming from python, so I may just write it > in that but I wanted to check first. In python, one would write: > > s="some string or other" > len(s.split()) For the archives: CREATE OR REPLACE FUNCTION word_length(text) RETURNS int4 AS 'return len(args[0].split())' LANGUAGE 'plpythonu' IMMUTABLE STRICT; Thanks all. -- Peter Fein pfein@xxxxxxxxx 773-575-0694 Basically, if you're not a utopianist, you're a schmuck. -J. Feldman ---------------------------(end of broadcast)--------------------------- TIP 1: subscribe and unsubscribe commands go to majordomo@xxxxxxxxxxxxxx