Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
47
Task/Binary-strings/FutureBasic/binary-strings-2.basic
Normal file
47
Task/Binary-strings/FutureBasic/binary-strings-2.basic
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
print @"----------------------"
|
||||
print @" CFString Examples"
|
||||
print @"----------------------"
|
||||
|
||||
// Dimension strings and iterator
|
||||
CFStringRef c, b
|
||||
NSUInteger j
|
||||
|
||||
// Create CFString as pointer to Core Foundation object
|
||||
c = @"Hello, world!"
|
||||
|
||||
// Get length of string
|
||||
print @"Length of \"Hello, world!\" is "; len(c); @" characters."
|
||||
|
||||
// String destruction
|
||||
c = @""
|
||||
|
||||
// String comparison
|
||||
if fn StringIsEqual( c, @"Hello, world!" ) then print @"Strings are equal"
|
||||
|
||||
// Copying string
|
||||
b = c
|
||||
|
||||
// Check if empty
|
||||
if len(c) == 0 then print @"String is empty"
|
||||
|
||||
// Append a byte
|
||||
c = fn StringWithString( @"A" )
|
||||
|
||||
// Extract a substring
|
||||
b = mid( c, 1, 5 )
|
||||
|
||||
// Substitute string "world" with "universe"
|
||||
b = @"Hello, world!"
|
||||
for j = 0 to len(b) - 1
|
||||
if ( fn StringIsEqual( mid( b, j, 6 ), @"world!" ) )
|
||||
b = fn StringWithFormat( @"%@%@", left( b, j ), @"universe!" )
|
||||
exit for
|
||||
end if
|
||||
next
|
||||
print b
|
||||
|
||||
// Join strings
|
||||
c = fn StringWithFormat( @"%@%@%@", @"See ", @"you ", @"later." )
|
||||
print c
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue