Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
74
Task/String-comparison/FutureBasic/string-comparison.basic
Normal file
74
Task/String-comparison/FutureBasic/string-comparison.basic
Normal file
|
|
@ -0,0 +1,74 @@
|
|||
void local fn StringComparison
|
||||
CFStringRef s1, s2
|
||||
NSComparisonResult result
|
||||
|
||||
window 1, @"String Comparison"
|
||||
|
||||
print @"• equal - case sensitive •"
|
||||
s1 = @"alpha" : s2 = @"alpha"
|
||||
if ( fn StringIsEqual( s1, s2 ) )
|
||||
printf @"\"%@\" is equal to \"%@\"",s1,s2
|
||||
end if
|
||||
|
||||
result = fn StringCompare( s1, s2 )
|
||||
if ( result == NSOrderedSame )
|
||||
printf @"\"%@\" is equal to \"%@\"",s1,s2
|
||||
end if
|
||||
|
||||
select ( s1 )
|
||||
case s2
|
||||
printf @"\"%@\" is equal to \"%@\"",s1,s2
|
||||
case else
|
||||
printf @"\"%@\" is not equal to \"%@\"",s1,s2
|
||||
end select
|
||||
|
||||
print @"\n• not equal - case sensitive •"
|
||||
s2 = @"bravo"
|
||||
if ( fn StringIsEqual( s1, s2 ) == NO )
|
||||
printf @"\"%@\" is not equal to \"%@\"",s1,s2
|
||||
end if
|
||||
|
||||
result = fn StringCompare( s1, s2 )
|
||||
if ( result != NSOrderedSame )
|
||||
printf @"\"%@\" is not equal to \"%@\"",s1,s2
|
||||
end if
|
||||
|
||||
select ( s1 )
|
||||
case s2
|
||||
printf @"\"%@\" is equal to \"%@\"",s1,s2
|
||||
case else
|
||||
printf @"\"%@\" is not equal to \"%@\"",s1,s2
|
||||
end select
|
||||
|
||||
print @"\n• ordered before - case sensitive •"
|
||||
result = fn StringCompare( s1, s2 )
|
||||
if ( result == NSOrderedAscending )
|
||||
printf @"\"%@\" is ordered before \"%@\"",s1,s2
|
||||
end if
|
||||
|
||||
print @"\n• ordered after - case sensitive •"
|
||||
result = fn StringCompare( s2, s1 )
|
||||
if ( result == NSOrderedDescending )
|
||||
printf @"\"%@\" is ordered after \"%@\"",s2,s1
|
||||
end if
|
||||
|
||||
print @"\n• equal - case insensitive •"
|
||||
s2 = @"AlPhA"
|
||||
result = fn StringCaseInsensitiveCompare( s1, s2 )
|
||||
if ( result == NSOrderedSame )
|
||||
printf @"\"%@\" is equal to \"%@\"",s1,s2
|
||||
end if
|
||||
|
||||
result = fn StringCompareWithOptions( s1, s2, NSCaseInsensitiveSearch )
|
||||
if ( result == NSOrderedSame )
|
||||
printf @"\"%@\" is equal to \"%@\"",s1,s2
|
||||
end if
|
||||
|
||||
if ( fn StringIsEqual( lcase(s1), lcase(s2) ) )
|
||||
printf @"\"%@\" is equal to \"%@\"",s1,s2
|
||||
end if
|
||||
end fn
|
||||
|
||||
fn StringComparison
|
||||
|
||||
HandleEvents
|
||||
Loading…
Add table
Add a link
Reference in a new issue