replaceFirst method

void replaceFirst(
  1. String value,
  2. String replacement
)

Replaces the first occurrence of a specified string in this instance with another string. Returns true if the value was found and replaced. Otherwise returns false.

Throws a ChilkatException if the call fails; the details are in ChilkatException.lastErrorText. Throws an ArgumentError if a string argument contains a NUL character.

Implementation

void replaceFirst(String value, String replacement) {
  final h = _handle;
  using((arena) {
    final r = _CkStringBuilder_ReplaceFirst(
      h,
      _toNative(arena, value, 'value'),
      _toNative(arena, replacement, 'replacement'),
    );
    if (r == 0) {
      throw _fail('replaceFirst');
    }
  });
}