课程: Java Algorithms
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Basic parsing and searching strings in Java
- [Instructor] A common programming task is to search for a piece of data within a string. Depending on the assumptions you make about a string's data, you can make an algorithm more or less efficient. If you know nothing about the string, you have to check every piece of data within the string in order to find the data you're searching for. If you know the string has its characters in a sorted alphabetical order, then you can optimize the algorithm by starting your search in the front, back, or middle of the string. In all of these cases, you need to parse the data within the string in order to find the character or substring you're looking for. Let's take a look at how to do that in Java. The least complex and least efficient way to search for a subset of characters within a string is to use the built-in contains method. We can use the contains method by accessing the string, in this case s, and we can say s.contains LL. We'll print this out to the console. The contains method will…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
Validate Strings in Java: All-or-nothing properties4 分钟 17 秒
-
(已锁定)
Validate strings in Java: Specific properties2 分钟 58 秒
-
(已锁定)
Normalize strings in Java4 分钟 38 秒
-
(已锁定)
Basic parsing and searching strings in Java3 分钟 39 秒
-
(已锁定)
Apply custom parsing to search algorithms3 分钟 24 秒
-
(已锁定)
Create algorithm-driven strings in Java3 分钟 46 秒
-
(已锁定)
Leverage built-in tools to generate custom data2 分钟 30 秒
-
(已锁定)
Solution: Reverse each word3 分钟 32 秒
-
-
-
-
-
-
-