From the course: C# Algorithms

Unlock the full course today

Join today to access over 24,600 courses taught by industry experts.

Create algorithm-driven strings in C#

Create algorithm-driven strings in C# - C# Tutorial

From the course: C# Algorithms

Create algorithm-driven strings in C#

- [Instructor] Another standard programming task is to create a new string based on input data. We've seen this a bit previously with toLower and replace where a string is inputted into a function, and a new string is created using the data from the input string. These two functions are built into the standard library, but let's try creating our own functions that dynamically build a string using input data. The algorithm we'll create will build the reverse of whatever string is inputted. It will reverse the string. We'll want to cover our base cases where the string is null or empty. We can use the built-in string function to do that. If either of these cases are true, we'll just return the input. That covers our base cases. When starting your software development journey, sometimes it can feel like you're cheating by using the functions built into the language or the standard library. This is not cheating. Software engineering is about using the best tools for the job to create the…

Contents