Looking for a given substring starting from a specified offset can be achieved by such code: ``str.substring(beginIndex).indexOf(char1)``. This works well, but it creates a new ``String`` for each call to the ``substring`` method. When this is done in a loop, a lot of ``Strings`` are created for nothing, which can lead to performance problems if ``str`` is large.