GoConqr hat ein neues Design! Sag uns, wie es dir gefällt.

Modul 8 von 9 · Medien

Replace Strings

Kostas Diakogiannis

Replace Strings

Replace string method

The replace function, when attached to a string can replace a part of a string, with another specified string. 

The function is simple. Accepts two arguments. The first contains the string that we want to get rid off, and the second contains the string that is going to replace it.

Take a closer look to the example above, we replace the word 'negative' which lies inside the sentence string variable, with the word 'positive'. The replaced string is stored into a new string variable. 

In the end, line 5 prints: 'I have something positive to say here'

Anleitung

Um im Kurs weiterzukommen, sende einen Versuch dieses Quiz ab. Du kannst ihn nach der letzten Frage absenden.

Zum gewählten Modul

Feedback

Worum geht es?

Wie gefällt dir das neue Design?

Dein Eindruck