REALbasic Olympics Logo


REALbasic Programming Contest 2005:
Event Number One

This event runs February 14, 2005 through midnight GMT April 4, 2005


Event 1: Replacing Styled Text

REALbasic makes it easy to trim, split, find, replace, or otherwise modify strings. However, you soon realize that REALbasic lacks equivalent methods for dealing with styled text. Using regular string functions on styled text will either eliminate the styling or style it incorrectly.

 

The Challenge:

Amateur Category Challenge:

Given an EditField containing styledText, an EditField containing a search string, and an EditField containing a replacement string, write code that replaces all occurrences of the search string with the replacement string (case sensitive, without iteration). The replacement string is required to take on the same styled text characteristics as the first letter of the text it replaces. The styled text characteristics of the remaining text in the editfield need to be preserved.

Example1: Replace all "Happy Birtday" with "Happy Birthday" in "Happy Birtday " results in "Happy Birthday"

Example2: Replace all "gg" with "ghhhg" in "ddddggggdddd" results in "ddddghhhgghhhgdddd" (Note: no iteration, gg remains)

 

Professional Category Challenge:

The same as the Amateur Challenge except that:

Example: Replace all "Happy B[a-z]*day" with "Happy Birthday" in "Happy birtday " (not case sensitive) results in "Happy Birthday"

 

This first event starts officially on Monday, 14th of February 2005 and runs seven weeks till midnight GMT on April 4th of March 2005.

The time of the currently fastest solution will be announced on this website and the REALbasic mailing list on a weekly basis. This gives you a chance to catch up should your entry fall behind. So get your name on the honor roll with an early entry!

 

Note: You can download the empty Event project here (8 kB). Call your code from the pushbutton. You are free to modify the example in any way you see fit (e.g. with custom classes, etc.) as long as the code required to measure the time is not modified in any way. See the Rules page for details on how to submit your contest entry.

 

Good Luck!

 

Markus

Home | Store | Browse Published Issues | Customer Service | Contribute | xDevLibrary

Site Copyright 2002-2024 by xDev Magazine and DesignWrite.
Xojo is a trademark of Xojo, Inc..