package study.hard.javalib.apache.commons.lang;

import static org.junit.Assert.*;

import org.apache.commons.lang.StringUtils;
import org.junit.Test;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

/**
 * Test Apache Commons Lang's StringUtils.
 * @author iandmyhand@gmail.com
 */
public class StringUtilsTest {

	private Logger logger = LoggerFactory.getLogger(getClass());

	@Test
	public void findNthOccurrenceOfCharacterInString() {
		int index = StringUtils.ordinalIndexOf("aaabaaabaaa", "b", 2);
		assertEquals(7, index);
		logger.debug("index: {}", index);
	}

}

@@ -572,10 +572,320 @@
 x);%0A%09%7D%0A%0A
+%09@Test%0A%09public void findNthOccurrenceOfCharacterInString2() %7B%0A%09%09String ip = %22123.456.789.012%22;%0A%09%09int index = StringUtils.ordinalIndexOf(ip, %22.%22, 2);%0A%09%09assertEquals(7, index);%0A%09%09logger.debug(%22index: %7B%7D%22, index);%0A%09%09ip = ip.substring(0, StringUtils.ordinalIndexOf(ip, %22.%22, 2));%0A%09%09assertEquals(%22123.456%22, ip);%0A%09%7D%0A%0A
 %7D%0A

Add a test case to find Nth occurrence of character in String.