@@ -0,0 +1,789 @@
+package by.vorokhobko.6_Control_questions;%0A%0A/**%0A* Substring.%0A*%0A* Class Substring finds the substring in the original string 001, lesson 6.%0A* @author Evgeny Vorokhobko (vorokhobko2011@yandex.ru).%0A* @since 03.01.2017.%0A* @version 1.%0A*/%0A%0Apublic class Substring %7B%0A%0A%09/**%0A%09* The class field.%0A%09* The method finds the substring.%0A%09* @param origin - origin.%0A%09* @param sub - sub%0A%09* @return tag.%0A%09*/%0A%0A%09public boolean contains(String origin, String sub) %7B%0A%09%09int originLength = origin.length();%0A%09%09int subLength = sub.length();%0A%09%09boolean def = false;%0A%09%09String result;%0A%09%09for (int i = 0; i %3C= (originLength - subLength); i++) %7B%0A%09%09%09if (origin.regionMatches(i, sub, 0, subLength)) %7B%0A%09%09%09%09def = true;%0A%09%09%09%09result = origin.substring(i, i + subLength);%0A%09%09%09%7D%0A%09%09%7D%0A%09%09if (!def) %7B%0A%09%09%09def = false;%0A%09%09%7D%0A%09%09return def;%0A%09%7D%0A%7D

add class Substring