replaceFirst()

Replaces the first occurrence of old in the current String with new.

Syntax

String  replaceFirst(String old, String new)
  1. old is the original string.
  2. new is the string that replaces old.

Usage

Backslashes (\) and dollar signs ($) in the replacement string may cause the results to be different than if it were being treated as a literal replacement string.