src/stringProcessing/specialCharacterMappings.js
function getIndicesOfWords( text ) {
	const indices = [];
	const words = getWords( text );
	let startSearchFrom = 0;

	words.forEach( function( word ) {
		const currentIndex = text.indexOf( word, startSearchFrom );
		indices.push( currentIndex );
		startSearchFrom = currentIndex + word.length;
	} );

	return indices;
}
function getIndicesOfWords( text ) {
	const indices = [];
	const words = getWords( text );
	let startSearchFrom = 0;

	words.forEach( function( word ) {
		const currentIndex = text.indexOf( word, startSearchFrom );
		indices.push( currentIndex );
		startSearchFrom = currentIndex + word.length;
	} );

	return indices;
}
function getIndicesOfWords ( text ) { const indices = [ ] ; const words = getWords ( text ) ; let startSearchFrom = 0 ; words . forEach ( function ( word ) { const currentIndex = text . indexOf ( word , startSearchFrom ) ; indices . push ( currentIndex ) ; startSearchFrom = currentIndex + word . length ; } ) ; return indices ; }
Gets positions of the first character of a word in the input text.

@param {string} text The original text, for which the indices of word beginnings need to be determined.

@returns {Array} indices The array of indices in the text at which words start.
Gets positions of the first character of a word in the input text .