private int getCharPosition(String text, int byteOffset) {
		int byteGroupSize = options.getByteGroupSize();
		int byteDelimiterLength = options.getByteDelimiter().length();

		int groupSize = byteGroupSize * 2 + byteDelimiterLength;
		int groupIndex = byteOffset / byteGroupSize;
		int groupOffset = byteOffset % byteGroupSize;

		int pos = groupIndex * groupSize + 2 * groupOffset;
		return Math.min(text.length() - 1, pos);
	}
Listing highlight provider to highlight memory search results.
Ghidra/Features/Base/src/main/java/ghidra/features/base/memsearch/gui/MemoryMatchHighlighter.java