tasks a-s
This commit is contained in:
parent
47bf37c096
commit
b83f433714
12433 changed files with 156208 additions and 123 deletions
8
Task/Reverse-a-string/FBSL/reverse-a-string-1.fbsl
Normal file
8
Task/Reverse-a-string/FBSL/reverse-a-string-1.fbsl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Function StrRev1(ByVal $p1)
|
||||
dim $b = ""
|
||||
repeat len(p1)
|
||||
b = b & right(p1,1)
|
||||
p1 = left(p1,len(p1)-1)
|
||||
end repeat
|
||||
return b
|
||||
End Function
|
||||
8
Task/Reverse-a-string/FBSL/reverse-a-string-2.fbsl
Normal file
8
Task/Reverse-a-string/FBSL/reverse-a-string-2.fbsl
Normal file
|
|
@ -0,0 +1,8 @@
|
|||
Function StrRev2(ByVal $p1)
|
||||
dim $b = ""
|
||||
dim %i
|
||||
for i = len(p1) downto 1
|
||||
b = b & mid(p1,i,1)
|
||||
next
|
||||
return b
|
||||
End Function
|
||||
7
Task/Reverse-a-string/FBSL/reverse-a-string-3.fbsl
Normal file
7
Task/Reverse-a-string/FBSL/reverse-a-string-3.fbsl
Normal file
|
|
@ -0,0 +1,7 @@
|
|||
Function StrRev3( $s )
|
||||
FOR DIM x = 1 TO LEN(s) \ 2
|
||||
PEEK(@s + LEN - x, $1)
|
||||
POKE(@s + LEN - x, s{x})(@s + x - 1, PEEK)
|
||||
NEXT
|
||||
RETURN s
|
||||
end function
|
||||
20
Task/Reverse-a-string/FBSL/reverse-a-string-4.fbsl
Normal file
20
Task/Reverse-a-string/FBSL/reverse-a-string-4.fbsl
Normal file
|
|
@ -0,0 +1,20 @@
|
|||
DynC StringRev($theString) As String
|
||||
void rev(char *str)
|
||||
{
|
||||
int len = strlen(str);
|
||||
char *HEAD = str;
|
||||
char *TAIL = str + len - 1;
|
||||
char temp;
|
||||
int i;
|
||||
for ( i = 0; i <= len / 2; i++, HEAD++, TAIL--) {
|
||||
temp = *HEAD;
|
||||
*HEAD = *TAIL;
|
||||
*TAIL = temp;
|
||||
}
|
||||
}
|
||||
char *main(char* theString)
|
||||
{
|
||||
rev(theString);
|
||||
return theString;
|
||||
}
|
||||
End DynC
|
||||
Loading…
Add table
Add a link
Reference in a new issue