An apparatus for finding a specific character, said apparatus for use during execution of a single instruction by a processor, said apparatus capable of being used repeatedly to find a specific character in a variable-length character string on a computer, said apparatus comprising:
- a first register capable of saving one or more characters of data;
- a second register having least significant bits for specifying an offset into said first register and having most significant bits for specifying a memory address of the contents of the first register;
- a third register having least significant bits for specifying an offset into said first register and having most significant bits for holding a copy of the contents of the most significant bits of the second register;
- byte comparing logic for concurrently comparing multiple bytes with a specific character, said logic having one or more OR-GATES coupled to the characters of said first register said OR-GATES arranged such that a character is coupled to a single OR-GATE and an OR-GATE is coupled to a single character;
- and
- a combinatorial logic unit having inputs coupled to the output of the byte comparing logic and to the least significant bits of the second register, the combinatorial logic unit producing an offset signal output which indicates an offset into said first register and which is passed to the least significant bits of said third register and a found signal output which indicates whether the specific character was found, said offset signal output being set to an offset specifying the location of the specific character within said first register if the specific character was found and being set to zero if the specific character was not found.