Update all new Tasks
This commit is contained in:
parent
00a190b0a6
commit
91df62d461
5697 changed files with 93386 additions and 804 deletions
22
Task/String-matching/Fantom/string-matching.fantom
Normal file
22
Task/String-matching/Fantom/string-matching.fantom
Normal file
|
|
@ -0,0 +1,22 @@
|
|||
class Main
|
||||
{
|
||||
public static Void main ()
|
||||
{
|
||||
string := "Fantom Language"
|
||||
echo ("String is: " + string)
|
||||
echo ("does string start with 'Fantom'? " + string.startsWith("Fantom"))
|
||||
echo ("does string start with 'Language'? " + string.startsWith("Language"))
|
||||
echo ("does string contain 'age'? " + string.contains("age"))
|
||||
echo ("does string contain 'page'? " + string.contains("page"))
|
||||
echo ("does string end with 'Fantom'? " + string.endsWith("Fantom"))
|
||||
echo ("does string end with 'Language'? " + string.endsWith("Language"))
|
||||
|
||||
echo ("Location of 'age' is: " + string.index("age"))
|
||||
posn := string.index ("an")
|
||||
echo ("First location of 'an' is: " + posn)
|
||||
posn = string.index ("an", posn+1)
|
||||
echo ("Second location of 'an' is: " + posn)
|
||||
posn = string.index ("an", posn+1)
|
||||
if (posn == null) echo ("No third location of 'an'")
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue