Hi All,
Five nice use cases of the / operator on a Softanza string:
# Usecase 1: Dividing the string into 3 equal parts
? Q("RingRingRing") / 3
# --> [ "Ring", "Ring", "Ring" ]
# Usecase 2: Splitting the string using a given char (or substring)
? Q("Ring;Python;Ruby") / ";"
# --> [ "Ring", "Python", "Ruby" ]
# Usecase 3: Splitting the string on each char verifying a condition
? Q("Ring:Python;Ruby") / W('Q(@Char).IsNotLetter()')
#--> [ "Ring", "Python", "Ruby" ]
# Usecase 4: Sharing the string equally between three stakeholders
? Q("RingRubyJava") / [ "Qute", "Nice", "Good" ]
# --> [ [ "Qute", "Ring" ], [ "Nice", "Ruby" ], [ "Good", "Java" ] ]
# Usecase 5: Specifying how mutch char we should give to every stakeholder
? Q("IAmRingDeveloper") / [
:Subject = 1,
:Verb = 2,
:Noun1 = 4,
:Noun2 = :RemainingChars
]
#--> [ :Subject = "I", :Verb = "Am", :Noun1 = "Ring", :Noun2 = "Developer" ]
Here it is running in Ring Notepad:
--
---
You received this message because you are subscribed to the Google Groups "The Ring Programming Language" group.
To unsubscribe from this group and stop receiving emails from it, send an email to ring-lang+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ring-lang/9ef12d95-577d-4f0f-9c3c-57ff2d78fa0bn%40googlegroups.com.