leetcode

Unnamed repository; edit this file 'description' to name the repository.
Log | Files | Refs | README

commit 6e713b3a1a7966646c5d6b7bf335b538ef3512f3
parent 4dae09e5a5dc85c0abab05de636071b572aed330
Author: AndrewLockVI <andrewlaack1@gmail.com>
Date:   Wed,  3 May 2023 20:07:02 -0500

Completed remove all occurences using dart

Diffstat:
Aremove-all-occurences-of-a-substring/remove-all-lazy.dart | 11+++++++++++
1 file changed, 11 insertions(+), 0 deletions(-)

diff --git a/remove-all-occurences-of-a-substring/remove-all-lazy.dart b/remove-all-occurences-of-a-substring/remove-all-lazy.dart @@ -0,0 +1,11 @@ +//Lazy solution to the problem +//Remove first instance of the string while it is contained +//in the list. +class Solution { + String removeOccurrences(String s, String part) { + while(s.contains(part)){ + s = s.replaceFirst(part, ""); + } + return s; + } +}