课程: Java Algorithms
今天就学习课程吧!
今天就开通帐号,24,700 门业界名师课程任您挑!
Create algorithm-driven strings in Java
- [Instructor] Another standard programming task is to create a new string based on input data. We've seen this a bit previously with toLowerCase and replace. For each of these, a string is inputted in the function and a new string is created using the data from this input string. These are built into the standard library but let's try creating our own functions that build a string dynamically using input data. The algorithm we'll create will build the reverse of whatever string is inputted. It will reverse the string. We'll start by covering our base cases. This is when the string is null or the string is empty. In these cases, we'll just return the input string. Now, let's reverse the string. When performing operations on strings, it can be very easy to create a bunch of unnecessary strings as you try to build this output string. This happens because string are immutable. You can't change them once they're created. To make our algorithm more efficient so that it doesn't create this…
随堂练习,边学边练
下载课堂讲义。学练结合,紧跟进度,轻松巩固知识。
内容
-
-
-
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 秒
-
-
-
-
-
-
-