Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
18
Task/Palindrome-detection/VBScript/palindrome-detection-1.vb
Normal file
18
Task/Palindrome-detection/VBScript/palindrome-detection-1.vb
Normal file
|
|
@ -0,0 +1,18 @@
|
|||
function Squish( s1 )
|
||||
dim sRes
|
||||
sRes = vbNullString
|
||||
dim i, c
|
||||
for i = 1 to len( s1 )
|
||||
c = lcase( mid( s1, i, 1 ))
|
||||
if instr( "abcdefghijklmnopqrstuvwxyz0123456789", c ) then
|
||||
sRes = sRes & c
|
||||
end if
|
||||
next
|
||||
Squish = sRes
|
||||
end function
|
||||
|
||||
function isPalindrome( s1 )
|
||||
dim squished
|
||||
squished = Squish( s1 )
|
||||
isPalindrome = ( squished = StrReverse( squished ) )
|
||||
end function
|
||||
|
|
@ -0,0 +1,4 @@
|
|||
wscript.echo isPalindrome( "My dog has fleas")
|
||||
wscript.echo isPalindrome( "Madam, I'm Adam.")
|
||||
wscript.echo isPalindrome( "1 on 1")
|
||||
wscript.echo isPalindrome( "In girum imus nocte et consumimur igni")
|
||||
Loading…
Add table
Add a link
Reference in a new issue