perl tr/y like function

is there a tr/// like function. example being translating upper to lower case (and not using toLowerCase) - tr/A-Z/a-z/ or something like tr/0-9/a-j/.

i'm tired - tia.
Who is Participating?
XxavierConnect With a Mentor Commented:
There is no such nethod in the stand JS functions see  the facility is privided as the to LowerCase method of the string object. It can be wrpped in a function as so though.

 function tr(str){
  return str.toLowerCase()
 alert(str+' '+tr(str))

ZylochConnect With a Mentor Commented:
Not to my knowledge. You might be able to fudge MOST of them with stringVar.replace(regex,replacement), however.

Also, because tr/// returns the number of matches (if my memory serves me correctly), you'd have to use a separate match like this:

var totalMatches=stringVar.split(regex).length;

ren_bAuthor Commented:
i'm just looking for a yes or no answer, and if yes, what's the function name. creating it wouldn't be a problem, iff i have to.
ren_bAuthor Commented:
i wasn't looking for a toLowerCase function - a javascript version of the tr program or tr function in perl - which you say there is no method. that's all i needed to know.
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.