output file "CSV2HTML" include "Tlbx WebKit.incl" _window = 1 begin enum output 1 _webView end enum void local fn BuildWindow CGRect r = fn CGRectMake( 0, 0, 600, 220 ) window _window, @"Rosetta Code CSV to HTML", r, NSWindowStyleMaskTitled + NSWindowStyleMaskClosable r = fn CGRectMake( 20, 20, 560, 180 ) wkwebview _webView, r,, _window end fn local fn CSV2HTML as CFStringRef NSUInteger i, count CFStringRef csvStr = @"Character,Speech\n¬ The multitude,The messiah! Show us the messiah!\n¬ Brians mother,Now you listen here! He's not the messiah; he's a very naughty boy! Now go away!\n¬ The multitude,Who are you\n¬ Brians mother,I'm his mother; that's who!\n¬ The multitude,Behold his mother! Behold his mother!" CFArrayRef linesArray = fn StringComponentsSeparatedByString( csvStr, @"\n" ) CFMutableStringRef htmlStr = fn MutableStringWithCapacity(0) MutableStringAppendString( htmlStr, @"
| Character | Speech |
|---|---|
| %@ | >\n", tempArr[0] ) ) MutableStringAppendString( htmlStr, fn StringWithFormat( @"%@ | \n", tempArr[1] ) ) MutableStringAppendString( htmlStr, @"