Anonymous user
String matching: Difference between revisions
m
Add Julia 1.0 version
m (Add Julia 1.0 version) |
|||
Line 1,675:
3: Does 'tacoloco' end with 'co'? Yes.</pre>
=={{header|Lasso}}==▼
<lang Lasso>local(▼
a = 'a quick brown peanut jumped over a quick brown fox',▼
b = 'a quick brown'▼
)▼
//Determining if the first string starts with second string▼
#a->beginswith(#b) // true▼
//Determining if the first string contains the second string at any location▼
#a >> #b // true▼
#a->contains(#b) // true▼
//Determining if the first string ends with the second string▼
#a->endswith(#b) // false</lang>▼
=={{header|jq}}==
Line 1,731 ⟶ 1,715:
=={{header|Julia }}==▼
endswith("abcd","zn") #returns false▼
println(r.offset)▼
end #returns 1, then 3 matching the two starting indices where the substring was found
</lang>
▲=={{header|Julia}}==
▲<lang julia>startswith("abcd","ab") #returns true
▲search("abcd","ab") #returns 1:2, indices range where string was found
▲endswith("abcd","zn") #returns false
▲ismatch(r"ab","abcd") #returns true where 1st arg is regex string
▲julia>for r in each_match(r"ab","abab")
▲ println(r.offset)
▲3</lang>
=={{header|K}}==
Line 1,764 ⟶ 1,748:
_ss["abcdabceabc";"abc"] / location of matches
0 4 8</lang>
=={{header|Kotlin}}==
Line 1,791 ⟶ 1,776:
[[File:LabVIEW_Character_matching_2.png]]<br/>
[[File:LabVIEW_Character_matching_3.png]]
▲=={{header|Lasso}}==
▲<lang Lasso>local(
▲ a = 'a quick brown peanut jumped over a quick brown fox',
▲ b = 'a quick brown'
▲)
▲//Determining if the first string starts with second string
▲#a->beginswith(#b) // true
▲//Determining if the first string contains the second string at any location
▲#a >> #b // true
▲#a->contains(#b) // true
▲//Determining if the first string ends with the second string
▲#a->endswith(#b) // false</lang>
=={{header|Lang5}}==
|