String comparison: Difference between revisions

m
imported>Thebeez
Line 1,255:
<pre>Igual que la entrada de FreeBASIC.</pre>
==={{header|uBasic/4tH}}===
{{works with|R3R4}}
uBasic/4tH provides a builtin, case insensitive function to compare two strings, called <code>COMP()</code> which returns either a negative, zero or positive value, just like <code>strcmp()</code>. In order to compare two strings case sensitive, a user defined function is required.
<syntaxhighlight lang="text">Print "Case sensitive"
Print "=============="
Print Show (FUNC(_Eval(FUNC(_StrCmp (Dup ("Dog"), Dup ("Dog"))))))
Print Show (FUNC(_Eval(FUNC(_StrCmp (Dup ("Dog"), Dup ("Cat"))))))
Print Show (FUNC(_Eval(FUNC(_StrCmp (Dup ("Dog"), Dup ("Rat"))))))
Print Show (FUNC(_Eval(FUNC(_StrCmp (Dup ("Dog"), Dup ("dog"))))))
Print Show (FUNC(_Eval(FUNC(_StrCmp (Dup ("Dog"), Dup ("Pig"))))))
 
Print
Line 1,291:
_Eval ' evaluate result
Param (1)
If a@ = 0 Then Return (Dup ("Equal"))
If a@ > 0 Then Return (Dup ("Second before First"))
Return (Dup ("First before Second"))</syntaxhighlight>
Output:
<pre>
Anonymous user