|
|
Line 4,009: |
Line 4,009: |
|
|
|
|
|
local fn AlignColumn |
|
local fn AlignColumn |
|
⚫ |
|
|
'~'1 |
|
|
|
|
⚫ |
|
|
|
⚫ |
CFStringRef testStr = @"Given$a$text$file$of$many$lines,$where$fields$within$a$line$are$delineated$by¬ |
|
|
|
|
⚫ |
$a$single$'dollar'$character,$write$a$program$that$aligns$each$column$of$fields$by$ensuring$that$words¬ |
⚫ |
CFStringRef testStr = @"Given$a$text$file$of$many$lines,$where$fields$within$a$line$are$delineated$by¬ |
|
|
⚫ |
$in$each$column$are$separated$by$at$least$one$space.$Further,$allow$for$each$word$in$a$column$to$be¬ |
⚫ |
$a$single$'dollar'$character,$write$a$program$that$aligns$each$column$of$fields$by$ensuring$that$words¬ |
|
|
⚫ |
$either$left$justified$right$justified,$or$center$justified$within$its$column." |
⚫ |
$in$each$column$are$separated$by$at$least$one$space.$Further,$allow$for$each$word$in$a$column$to$be¬ |
|
|
|
|
⚫ |
$either$left$justified$right$justified,$or$center$justified$within$its$column." |
|
|
⚫ |
CFArrayRef temp = fn StringComponentsSeparatedByString( testStr, @"$" ) |
|
|
|
|
⚫ |
CFMutableArrayRef arr = fn MutableArrayWithArray( temp ) |
⚫ |
CFArrayRef temp = fn StringComponentsSeparatedByString( testStr, @"$" ) |
|
|
⚫ |
NSUInteger count = fn ArrayCount( arr ) |
⚫ |
CFMutableArrayRef arr = fn MutableArrayWithArray( temp ) |
|
|
⚫ |
|
⚫ |
NSUInteger count = fn ArrayCount( arr ) |
|
|
|
|
⚫ |
|
|
|
⚫ |
NSLog( @"\nLeft aligned:\n" ) |
|
|
|
|
⚫ |
|
⚫ |
NSLog( @"\nLeft aligned:\n" ) |
|
|
⚫ |
|
⚫ |
|
|
|
⚫ |
a( lineCheck ) = (ptr)fn StringUTF8String( arr[i] ) |
⚫ |
|
|
|
⚫ |
|
⚫ |
a( lineCheck ) = (ptr)fn StringUTF8String( arr[i] ) |
|
|
⚫ |
NSLog( @"%-12s %-11s %-12s %-11s %-12s %-12s %-12s %-12s %-12s", a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9) ) |
⚫ |
|
|
|
⚫ |
|
⚫ |
NSLog( @"%-12s %-11s %-12s %-11s %-12s %-12s %-12s %-12s %-12s", a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9) ) |
|
|
⚫ |
|
⚫ |
|
|
|
⚫ |
|
⚫ |
|
|
|
⚫ |
|
⚫ |
|
|
|
⚫ |
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
⚫ |
NSLog( @"\n\nRight aligned:\n" ) |
|
|
|
|
|
|
⚫ |
NSLog( @"\n\nRight aligned:\n" ) |
|
|
⚫ |
|
|
|
|
|
⚫ |
|
⚫ |
|
|
|
⚫ |
a( lineCheck ) = (ptr)fn StringUTF8String( arr[i] ) |
⚫ |
|
|
|
⚫ |
|
⚫ |
a( lineCheck ) = (ptr)fn StringUTF8String( arr[i] ) |
|
|
⚫ |
NSLog( @"%12s %11s %12s %11s %12s %12s %12s %12s %12s", a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9) ) |
⚫ |
|
|
|
⚫ |
|
⚫ |
NSLog( @"%12s %11s %12s %11s %12s %12s %12s %12s %12s", a(1),a(2),a(3),a(4),a(5),a(6),a(7),a(8),a(9) ) |
|
|
⚫ |
|
⚫ |
|
|
|
⚫ |
|
⚫ |
|
|
|
⚫ |
|
⚫ |
|
|
|
⚫ |
|
⚫ |
|
|
|
|
|
⚫ |
|
|
|
|
|
|
end fn |
|
end fn |
|
|
|
|
Line 4,077: |
Line 4,076: |
|
justified right justified, or center justified within its column. |
|
justified right justified, or center justified within its column. |
|
</pre> |
|
</pre> |
|
|
|
|
|
|
|
|
=={{header|Gambas}}== |
|
=={{header|Gambas}}== |