This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#nummern = IO.read("contacts.txt"); | |
class Contact | |
def initialize(name, phone) | |
@name = name; | |
@phone = phone; | |
end; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Definition des regulären Ausdrucks | |
uhrzeitRegexp = /(2[0-3]|[0-1]?[0-9]):[0-5][0-9]/; | |
# Zeichenkette aus Datei "zeitplan.txt" auslesen | |
text = IO.read("zeitplan.txt"); | |
# Matche meinen regulären Ausdruck mit `text`, | |
# gebe alle Vorkommen aus und betrachte Reststring | |
# für weiteres Matching |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#natRegexp = /(0|[1-9]([0-9])*)/; | |
# Definition einer FUNKTION(!) für natRegexp | |
# Matche natRegexp gegen `str` an Position `pos` | |
def match_0O1Bis90Bis9S(pos,str) | |
# Es kann folgende Unterscheidung für den nächsten Buchstaben gemacht werden: | |
# Matche /0/ gegen `str` an Position `pos` | |
p1 = match_0(pos,str); | |
# Matche /[1-9][0-9]*/ gegen `str` an Position `pos` | |
p2 = match_1Bis90Bis9S(pos,str); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
###################################################### | |
# Algorithmus aus der Vorlesung | |
###################################################### | |
#text= "Die Giraffe trinkt Kaffee."; | |
#sub = "affe"; | |
#i=0; | |
#while i < text.length && text[i,sub.length] != sub do | |
# i = i + 1; | |
#end; |
NewerOlder