mirror of
				https://github.com/RGBCube/serenity
				synced 2025-10-31 15:32:46 +00:00 
			
		
		
		
	AK+Everywhere: Consolidate String::index_of() and String::find()
We had two functions for doing mostly the same thing. Combine both of them into String::find() and use that everywhere. Also add some tests to cover basic behavior.
This commit is contained in:
		
							parent
							
								
									875a2cbb71
								
							
						
					
					
						commit
						de395a3df2
					
				
					 12 changed files with 36 additions and 30 deletions
				
			
		|  | @ -389,7 +389,7 @@ public: | |||
|     { | ||||
|         if (const auto start_pos = pseudo_name.find('('); start_pos.has_value()) { | ||||
|             const auto start = start_pos.value() + 1; | ||||
|             if (const auto end_pos = pseudo_name.index_of(")", start); end_pos.has_value()) { | ||||
|             if (const auto end_pos = pseudo_name.find(')', start); end_pos.has_value()) { | ||||
|                 return pseudo_name.substring_view(start, end_pos.value() - start).trim_whitespace(); | ||||
|             } | ||||
|         } | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue
	
	 Andreas Kling
						Andreas Kling