Text between: Difference between revisions

m
Swift: put method at top
(Add Swift)
m (Swift: put method at top)
Line 2,450:
 
<lang swift>import Foundation
 
let tests = [
("Hello Rosetta Code world", "Hello ", " world"),
("Hello Rosetta Code world", "start", " world"),
("Hello Rosetta Code world", "Hello ", "end"),
("</div><div style=\"chinese\">你好嗎</div>", "<div style=\"chinese\">", "</div>"),
("<text>Hello <span>Rosetta Code</span> world</text><table style=\"myTable\">", "<text>", "<table>"),
("<table style=\"myTable\"><tr><td>hello world</td></tr></table>", "<table>", "</table>"),
("The quick brown fox jumps over the lazy other fox", "quick ", " fox"),
("One fish two fish red fish blue fish", "fish ", " red"),
("FooBarBazFooBuxQuux", "Foo", "Foo")
 
public extension String {
Line 2,489 ⟶ 2,477:
}
}
 
let tests = [
("Hello Rosetta Code world", "Hello ", " world"),
("Hello Rosetta Code world", "start", " world"),
("Hello Rosetta Code world", "Hello ", "end"),
("</div><div style=\"chinese\">你好嗎</div>", "<div style=\"chinese\">", "</div>"),
("<text>Hello <span>Rosetta Code</span> world</text><table style=\"myTable\">", "<text>", "<table>"),
("<table style=\"myTable\"><tr><td>hello world</td></tr></table>", "<table>", "</table>"),
("The quick brown fox jumps over the lazy other fox", "quick ", " fox"),
("One fish two fish red fish blue fish", "fish ", " red"),
("FooBarBazFooBuxQuux", "Foo", "Foo")
 
for (input, start, end) in tests {