Site logo

String

Function Unaccent by Peter Kahrel

Trimming (deleting leading and trailing white space)

function trim (str) {  
  return str.replace(/^\s+/,'').replace(/\s+$/,'');  
}

This function also take care of new lines, carriage return, tabs, etc:

function trim (str) {  
  return str.replace(/(^[\s\n\r\t\x0B]+)|([\s\n\r\t\x0B]+$)/g, '');  
}