Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

trim() für JavaScript

Empfohlene Antworten

Veröffentlicht

Von VB erinnere ich mich an eine TRIM() Funktion, die Leerzeichen an Anfang und Ende eines Strings abschneidet. Gibt es eine solche Funktion auch für JavaScript?

schau ma was der google bringt:

http://www.js-x.com/javascript/?view=932


<script language="javascript">

<!--

// create the prototype on the String object


String.prototype.trim = function() {


 // skip leading and trailing whitespace

 // and return everything in between

  var x=this;

  x=x.replace(/^\s*(.*)/, "$1");

  x=x.replace(/(.*?)\s*$/, "$1");

  return x;

}


// copy 'txtIn' to 'txtOut', trimming off unused whitespace

function btnClick() {

  // get the string value from the 'txtIn' element

  var s = document.frm1.txtIn.value;


  // trim the string value and put it into the 'txtOut' element

  document.frm1.txtOut.value = s.trim();

}


//-->

</script>

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.