String functions

# Keryx Web (17 years ago)

I am new to this list and perhaps my questions have been answered. If so, could anyone point me to those discussions.

I see that string.trim is part of the suggested spec. Coming from PHP the thing I miss the most when programming JavaScript is the plethora of string functions, and the printf family of functions.

Besides trim, I have not been able to see any suggestions.

My questions: What string functions have been discussed? Are there any more that might make it? If I provide my use case, might a new function be considered for inclusion?

Have the printf/sprintf been considered for inclusion? If so, with named parameters as in Python (which I do miss in PHP)?

The functions I personally miss the most are:

  • ucfirst
  • number_format
  • sha1
  • levenshtein

As well as ltrim and rtrim, but I see that they are being discussed on the wiki.

Lars Gunther

# Lars Hansen (17 years ago)

-----Original Message----- From: es4-discuss-bounces at mozilla.org [mailto:es4-discuss-bounces at mozilla.org] On Behalf Of Keryx Web Sent: 10. april 2008 10:59 To: es4-discuss at mozilla.org Subject: String functions

Hi all!

I am new to this list and perhaps my questions have been answered. If so, could anyone point me to those discussions.

I see that string.trim is part of the suggested spec. Coming from PHP the thing I miss the most when programming JavaScript is the plethora of string functions, and the printf family of functions.

Besides trim, I have not been able to see any suggestions.

There are no other accepted proposals for extending the set of string functions, apart from making some string methods also available as static methods on the string class (since they are generic anyhow).

My questions: What string functions have been discussed? Are there any more that might make it? If I provide my use case, might a new function be considered for inclusion?

Not likely at this date, but you can always try.

Have the printf/sprintf been considered for inclusion?

Similar functions have been considered, and rejected. Curiously, I can't find writeups of the rejected proposals now.

(Don't know what you would do with printf() since there's no stdout.)

If so, with named parameters as in Python (which I do miss in PHP)?

The functions I personally miss the most are:

  • ucfirst
  • number_format
  • sha1
  • levenshtein

Presumably one of the formatting functions on Number will suit you for number_format; the others are probably out of the question.

As well as ltrim and rtrim, but I see that they are being discussed on the wiki.

But are not included in the spec.

# Jon Zeppieri (17 years ago)

On Thu, Apr 10, 2008 at 1:30 PM, Lars Hansen <lhansen at adobe.com> wrote:

Have the printf/sprintf been considered for inclusion?

Similar functions have been considered, and rejected. Curiously, I can't find writeups of the rejected proposals now.

Referred to in: mail.mozilla.org/pipermail/es4-discuss/2007-October/001307.html

# Keryx Web (17 years ago)

Lars Hansen skrev:

Similar functions have been considered, and rejected. Curiously, I can't find writeups of the rejected proposals now.

(Don't know what you would do with printf() since there's no stdout.)

FWIW: Correct, I would not use printf. Only sprintf. Anyway, thanks for the replies.

Lars Gunther