kazuyamaa/multi-language-messages-01 huggingface dataset:
Task: Count in octal
Java: public class Count{
    public static void main(String[] args){
        for(int i = 0;i >= 0;i++){
            System.out.println(Integer.toOctalString(i)); 
        }
    }
}

VB: For i = 0 To 20
	WScript.StdOut.WriteLine Oct(i)
Next
Task: Count in octal
Go: package main

import (
    "fmt"
    "math"
)

func main() {
    for i := int8(0); ; i++ {
        fmt.Printf("%o\n", i)
        if i == math.MaxInt8 {
            break
        }
    }
}

VB: For i = 0 To 20
	WScript.StdOut.WriteLine Oct(i)
Next
Task: Count in octal
Python: import sys
for n in xrange(sys.maxint):
    print oct(n)

VB: For i = 0 To 20
	WScript.StdOut.WriteLine Oct(i)
Next
Task: Count in octal
C: #include <stdio.h>

int main()
{
        unsigned int i = 0;
        do { printf("%o\n", i++); } while(i);
        return 0;
}

Python: import sys
for n in xrange(sys.maxint):
    print oct(n)
Task: Count in octal
C: #include <stdio.h>

int main()
{
        unsigned int i = 0;
        do { printf("%o\n", i++); } while(i);
        return 0;
}

PHP: <?php
for ($n = 0; is_int($n); $n++) {
  echo decoct($n), "\n";
}
?>
Task: Count in octal
C#: using System;

class Program
{
    static void Main()
    {
        var number = 0;
        do
        {
            Console.WriteLine(Convert.ToString(number, 8));
        } while (++number > 0);
    }
}

PHP: <?php
for ($n = 0; is_int($n); $n++) {
  echo decoct($n), "\n";
}
?>
Task: Count in octal
C++: #include <iostream>

int main()
{
  unsigned i = 0;
  do
  {
    std::cout << std::oct << i << std::endl;
    ++i;
  } while(i != 0);
  return 0;
}

PHP: <?php
for ($n = 0; is_int($n); $n++) {
  echo decoct($n), "\n";
}
?>
Task: Count in octal
Go: package main

import (
    "fmt"
    "math"
)

func main() {
    for i := int8(0); ; i++ {
        fmt.Printf("%o\n", i)
        if i == math.MaxInt8 {
            break
        }
    }
}

PHP: <?php
for ($n = 0; is_int($n); $n++) {
  echo decoct($n), "\n";
}
?>
Task: Count in octal
Java: public class Count{
    public static void main(String[] args){
        for(int i = 0;i >= 0;i++){
            System.out.println(Integer.toOctalString(i)); 
        }
    }
}

PHP: <?php
for ($n = 0; is_int($n); $n++) {
  echo decoct($n), "\n";
}
?>
Task: Count in octal
Python: import sys
for n in xrange(sys.maxint):
    print oct(n)

PHP: <?php
for ($n = 0; is_int($n); $n++) {
  echo decoct($n), "\n";
}
?>
Task: Count in octal
VB: For i = 0 To 20
	WScript.StdOut.WriteLine Oct(i)
Next

PHP: <?php
for ($n = 0; is_int($n); $n++) {
  echo decoct($n), "\n";
}
?>
Task: Extract file extension
C: #include <assert.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>


char* file_ext(const char *string)
{
    assert(string != NULL);
    char *ext = strrchr(string, '.');

    if (ext == NULL)
        return (char*) string + strlen(string);

    for (char *iter = ext + 1; *iter != '\0'; iter++) {
        if (!isalnum((unsigned char)*iter))
            return (char*) string + strlen(string);
    }

    return ext;
}

int main(void)
{
    const char *testcases[][2] = {
        {"http:
        {"CharacterModel.3DS", ".3DS"},
        {".desktop", ".desktop"},
        {"document", ""},
        {"document.txt_backup", ""},
        {"/etc/pam.d/login", ""}
    };

    int exitcode = 0;
    for (size_t i = 0; i < sizeof(testcases) / sizeof(testcases[0]); i++) {
        const char *ext = file_ext(testcases[i][0]);
        if (strcmp(ext, testcases[i][1]) != 0) {
            fprintf(stderr, "expected '%s' for '%s', got '%s'\n",
                testcases[i][1], testcases[i][0], ext);
            exitcode = 1;
        }
    }
    return exitcode;
}

C#: #include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#include <regex>

std::string findExtension ( const std::string & filename ) {
   auto position = filename.find_last_of ( '.' ) ;
   if ( position == std::string::npos )
      return "" ;
   else {
      std::string extension ( filename.substr( position + 1 ) ) ;
      if (std::regex_search (extension, std::regex("[^A-Za-z0-9]") ))
         return "" ;
      else
         return extension ;
   }
}

int main( ) {
   std::vector<std::string> filenames {"picture.jpg" , "http:
      "myuniquefile.longextension" , "IAmAFileWithoutExtension" , "/path/to.my/file" ,
      "file.odd_one", "thisismine." } ;
   std::vector<std::string> extensions( filenames.size( ) ) ;
   std::transform( filenames.begin( ) , filenames.end( ) , extensions.begin( ) , findExtension ) ;
   for ( int i = 0 ; i < filenames.size( ) ; i++ )
      std::cout << filenames[i] << " has extension : " << extensions[i] << " !\n" ;
   return 0 ;
}
Task: Extract file extension
C: #include <assert.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>


char* file_ext(const char *string)
{
    assert(string != NULL);
    char *ext = strrchr(string, '.');

    if (ext == NULL)
        return (char*) string + strlen(string);

    for (char *iter = ext + 1; *iter != '\0'; iter++) {
        if (!isalnum((unsigned char)*iter))
            return (char*) string + strlen(string);
    }

    return ext;
}

int main(void)
{
    const char *testcases[][2] = {
        {"http:
        {"CharacterModel.3DS", ".3DS"},
        {".desktop", ".desktop"},
        {"document", ""},
        {"document.txt_backup", ""},
        {"/etc/pam.d/login", ""}
    };

    int exitcode = 0;
    for (size_t i = 0; i < sizeof(testcases) / sizeof(testcases[0]); i++) {
        const char *ext = file_ext(testcases[i][0]);
        if (strcmp(ext, testcases[i][1]) != 0) {
            fprintf(stderr, "expected '%s' for '%s', got '%s'\n",
                testcases[i][1], testcases[i][0], ext);
            exitcode = 1;
        }
    }
    return exitcode;
}

C++: #include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#include <regex>

std::string findExtension ( const std::string & filename ) {
   auto position = filename.find_last_of ( '.' ) ;
   if ( position == std::string::npos )
      return "" ;
   else {
      std::string extension ( filename.substr( position + 1 ) ) ;
      if (std::regex_search (extension, std::regex("[^A-Za-z0-9]") ))
         return "" ;
      else
         return extension ;
   }
}

int main( ) {
   std::vector<std::string> filenames {"picture.jpg" , "http:
      "myuniquefile.longextension" , "IAmAFileWithoutExtension" , "/path/to.my/file" ,
      "file.odd_one", "thisismine." } ;
   std::vector<std::string> extensions( filenames.size( ) ) ;
   std::transform( filenames.begin( ) , filenames.end( ) , extensions.begin( ) , findExtension ) ;
   for ( int i = 0 ; i < filenames.size( ) ; i++ )
      std::cout << filenames[i] << " has extension : " << extensions[i] << " !\n" ;
   return 0 ;
}
Task: Extract file extension
C: #include <assert.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>


char* file_ext(const char *string)
{
    assert(string != NULL);
    char *ext = strrchr(string, '.');

    if (ext == NULL)
        return (char*) string + strlen(string);

    for (char *iter = ext + 1; *iter != '\0'; iter++) {
        if (!isalnum((unsigned char)*iter))
            return (char*) string + strlen(string);
    }

    return ext;
}

int main(void)
{
    const char *testcases[][2] = {
        {"http:
        {"CharacterModel.3DS", ".3DS"},
        {".desktop", ".desktop"},
        {"document", ""},
        {"document.txt_backup", ""},
        {"/etc/pam.d/login", ""}
    };

    int exitcode = 0;
    for (size_t i = 0; i < sizeof(testcases) / sizeof(testcases[0]); i++) {
        const char *ext = file_ext(testcases[i][0]);
        if (strcmp(ext, testcases[i][1]) != 0) {
            fprintf(stderr, "expected '%s' for '%s', got '%s'\n",
                testcases[i][1], testcases[i][0], ext);
            exitcode = 1;
        }
    }
    return exitcode;
}

Go: package main

import "fmt"

func Ext(path string) string {
	for i := len(path) - 1; i >= 0; i-- {
		c := path[i]
		switch {
		case c == '.':
			return path[i:]
		case '0' <= c && c <= '9':
		case 'A' <= c && c <= 'Z':
		case 'a' <= c && c <= 'z':
		default:
			return ""
		}
	}
	return ""
}

func main() {
	type testcase struct {
		input  string
		output string
	}

	tests := []testcase{
		{"http:
		{"CharacterModel.3DS", ".3DS"},
		{".desktop", ".desktop"},
		{"document", ""},
		{"document.txt_backup", ""},
		{"/etc/pam.d/login", ""},
	}

	for _, testcase := range tests {
		ext := Ext(testcase.input)
		if ext != testcase.output {
			panic(fmt.Sprintf("expected %q for %q, got %q",
				testcase.output, testcase.input, ext))
		}
	}
}
Task: Extract file extension
C: #include <assert.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>


char* file_ext(const char *string)
{
    assert(string != NULL);
    char *ext = strrchr(string, '.');

    if (ext == NULL)
        return (char*) string + strlen(string);

    for (char *iter = ext + 1; *iter != '\0'; iter++) {
        if (!isalnum((unsigned char)*iter))
            return (char*) string + strlen(string);
    }

    return ext;
}

int main(void)
{
    const char *testcases[][2] = {
        {"http:
        {"CharacterModel.3DS", ".3DS"},
        {".desktop", ".desktop"},
        {"document", ""},
        {"document.txt_backup", ""},
        {"/etc/pam.d/login", ""}
    };

    int exitcode = 0;
    for (size_t i = 0; i < sizeof(testcases) / sizeof(testcases[0]); i++) {
        const char *ext = file_ext(testcases[i][0]);
        if (strcmp(ext, testcases[i][1]) != 0) {
            fprintf(stderr, "expected '%s' for '%s', got '%s'\n",
                testcases[i][1], testcases[i][0], ext);
            exitcode = 1;
        }
    }
    return exitcode;
}

Java: public class Test {
 
    public static void main(String[] args) {
        String[] filenames = { "http:
                               "CharacterModel.3DS",
                               ".desktop",
                               "document",
                               "document.txt_backup",
                               "/etc/pam.d/login"
        };

        for (String filename : filenames) {
            String ext = "null";
            int idx = filename.lastIndexOf('.');
            if (idx != -1) {
                String tmp = filename.substring(idx);
                if (tmp.matches("\\.[a-zA-Z0-9]+")) {
                    ext = tmp;
                }
            }
            System.out.println(filename + " -> " + ext);
        }
    }
}
Task: Extract file extension
C: #include <assert.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>


char* file_ext(const char *string)
{
    assert(string != NULL);
    char *ext = strrchr(string, '.');

    if (ext == NULL)
        return (char*) string + strlen(string);

    for (char *iter = ext + 1; *iter != '\0'; iter++) {
        if (!isalnum((unsigned char)*iter))
            return (char*) string + strlen(string);
    }

    return ext;
}

int main(void)
{
    const char *testcases[][2] = {
        {"http:
        {"CharacterModel.3DS", ".3DS"},
        {".desktop", ".desktop"},
        {"document", ""},
        {"document.txt_backup", ""},
        {"/etc/pam.d/login", ""}
    };

    int exitcode = 0;
    for (size_t i = 0; i < sizeof(testcases) / sizeof(testcases[0]); i++) {
        const char *ext = file_ext(testcases[i][0]);
        if (strcmp(ext, testcases[i][1]) != 0) {
            fprintf(stderr, "expected '%s' for '%s', got '%s'\n",
                testcases[i][1], testcases[i][0], ext);
            exitcode = 1;
        }
    }
    return exitcode;
}

Python: import re
def extractExt(url):
  m = re.search(r'\.[A-Za-z0-9]+$', url)
  return m.group(0) if m else ""
Task: Extract file extension
C: #include <assert.h>
#include <ctype.h>
#include <string.h>
#include <stdio.h>


char* file_ext(const char *string)
{
    assert(string != NULL);
    char *ext = strrchr(string, '.');

    if (ext == NULL)
        return (char*) string + strlen(string);

    for (char *iter = ext + 1; *iter != '\0'; iter++) {
        if (!isalnum((unsigned char)*iter))
            return (char*) string + strlen(string);
    }

    return ext;
}

int main(void)
{
    const char *testcases[][2] = {
        {"http:
        {"CharacterModel.3DS", ".3DS"},
        {".desktop", ".desktop"},
        {"document", ""},
        {"document.txt_backup", ""},
        {"/etc/pam.d/login", ""}
    };

    int exitcode = 0;
    for (size_t i = 0; i < sizeof(testcases) / sizeof(testcases[0]); i++) {
        const char *ext = file_ext(testcases[i][0]);
        if (strcmp(ext, testcases[i][1]) != 0) {
            fprintf(stderr, "expected '%s' for '%s', got '%s'\n",
                testcases[i][1], testcases[i][0], ext);
            exitcode = 1;
        }
    }
    return exitcode;
}

VB: Function fileExt(fname)
	Set fso = CreateObject("Scripting.FileSystemObject")
	Set regex = new regExp
        Dim ret

	regex.pattern = "^[A-Za-z0-9]+$"	
	If regex.test(fso.GetExtensionName(fname)) = False Then
		ret = ""
	Else
		ret = "." & fso.GetExtensionName(fname)
	End If
	fileExt = ret
End Function
 

arr_t = Array("http://example.com/download.tar.gz",	_
	      "CharacterModel.3DS",			_
	      ".desktop",				_
	      "document",				_
	      "document.txt_backup",			_
	      "/etc/pam.d/login")
 
For Each name In arr_t
	Wscript.Echo "NAME:",name
	Wscript.Echo " EXT:","<" & fileExt(name) & ">"
Next
Task: Extract file extension
C++: #include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#include <regex>

std::string findExtension ( const std::string & filename ) {
   auto position = filename.find_last_of ( '.' ) ;
   if ( position == std::string::npos )
      return "" ;
   else {
      std::string extension ( filename.substr( position + 1 ) ) ;
      if (std::regex_search (extension, std::regex("[^A-Za-z0-9]") ))
         return "" ;
      else
         return extension ;
   }
}

int main( ) {
   std::vector<std::string> filenames {"picture.jpg" , "http:
      "myuniquefile.longextension" , "IAmAFileWithoutExtension" , "/path/to.my/file" ,
      "file.odd_one", "thisismine." } ;
   std::vector<std::string> extensions( filenames.size( ) ) ;
   std::transform( filenames.begin( ) , filenames.end( ) , extensions.begin( ) , findExtension ) ;
   for ( int i = 0 ; i < filenames.size( ) ; i++ )
      std::cout << filenames[i] << " has extension : " << extensions[i] << " !\n" ;
   return 0 ;
}

Go: package main

import "fmt"

func Ext(path string) string {
	for i := len(path) - 1; i >= 0; i-- {
		c := path[i]
		switch {
		case c == '.':
			return path[i:]
		case '0' <= c && c <= '9':
		case 'A' <= c && c <= 'Z':
		case 'a' <= c && c <= 'z':
		default:
			return ""
		}
	}
	return ""
}

func main() {
	type testcase struct {
		input  string
		output string
	}

	tests := []testcase{
		{"http:
		{"CharacterModel.3DS", ".3DS"},
		{".desktop", ".desktop"},
		{"document", ""},
		{"document.txt_backup", ""},
		{"/etc/pam.d/login", ""},
	}

	for _, testcase := range tests {
		ext := Ext(testcase.input)
		if ext != testcase.output {
			panic(fmt.Sprintf("expected %q for %q, got %q",
				testcase.output, testcase.input, ext))
		}
	}
}
Task: Extract file extension
C++: #include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#include <regex>

std::string findExtension ( const std::string & filename ) {
   auto position = filename.find_last_of ( '.' ) ;
   if ( position == std::string::npos )
      return "" ;
   else {
      std::string extension ( filename.substr( position + 1 ) ) ;
      if (std::regex_search (extension, std::regex("[^A-Za-z0-9]") ))
         return "" ;
      else
         return extension ;
   }
}

int main( ) {
   std::vector<std::string> filenames {"picture.jpg" , "http:
      "myuniquefile.longextension" , "IAmAFileWithoutExtension" , "/path/to.my/file" ,
      "file.odd_one", "thisismine." } ;
   std::vector<std::string> extensions( filenames.size( ) ) ;
   std::transform( filenames.begin( ) , filenames.end( ) , extensions.begin( ) , findExtension ) ;
   for ( int i = 0 ; i < filenames.size( ) ; i++ )
      std::cout << filenames[i] << " has extension : " << extensions[i] << " !\n" ;
   return 0 ;
}

Java: public class Test {
 
    public static void main(String[] args) {
        String[] filenames = { "http:
                               "CharacterModel.3DS",
                               ".desktop",
                               "document",
                               "document.txt_backup",
                               "/etc/pam.d/login"
        };

        for (String filename : filenames) {
            String ext = "null";
            int idx = filename.lastIndexOf('.');
            if (idx != -1) {
                String tmp = filename.substring(idx);
                if (tmp.matches("\\.[a-zA-Z0-9]+")) {
                    ext = tmp;
                }
            }
            System.out.println(filename + " -> " + ext);
        }
    }
}
Task: Extract file extension
C++: #include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#include <regex>

std::string findExtension ( const std::string & filename ) {
   auto position = filename.find_last_of ( '.' ) ;
   if ( position == std::string::npos )
      return "" ;
   else {
      std::string extension ( filename.substr( position + 1 ) ) ;
      if (std::regex_search (extension, std::regex("[^A-Za-z0-9]") ))
         return "" ;
      else
         return extension ;
   }
}

int main( ) {
   std::vector<std::string> filenames {"picture.jpg" , "http:
      "myuniquefile.longextension" , "IAmAFileWithoutExtension" , "/path/to.my/file" ,
      "file.odd_one", "thisismine." } ;
   std::vector<std::string> extensions( filenames.size( ) ) ;
   std::transform( filenames.begin( ) , filenames.end( ) , extensions.begin( ) , findExtension ) ;
   for ( int i = 0 ; i < filenames.size( ) ; i++ )
      std::cout << filenames[i] << " has extension : " << extensions[i] << " !\n" ;
   return 0 ;
}

Python: import re
def extractExt(url):
  m = re.search(r'\.[A-Za-z0-9]+$', url)
  return m.group(0) if m else ""
Task: Extract file extension
C++: #include <string>
#include <algorithm>
#include <iostream>
#include <vector>
#include <regex>

std::string findExtension ( const std::string & filename ) {
   auto position = filename.find_last_of ( '.' ) ;
   if ( position == std::string::npos )
      return "" ;
   else {
      std::string extension ( filename.substr( position + 1 ) ) ;
      if (std::regex_search (extension, std::regex("[^A-Za-z0-9]") ))
         return "" ;
      else
         return extension ;
   }
}

int main( ) {
   std::vector<std::string> filenames {"picture.jpg" , "http:
      "myuniquefile.longextension" , "IAmAFileWithoutExtension" , "/path/to.my/file" ,
      "file.odd_one", "thisismine." } ;
   std::vector<std::string> extensions( filenames.size( ) ) ;
   std::transform( filenames.begin( ) , filenames.end( ) , extensions.begin( ) , findExtension ) ;
   for ( int i = 0 ; i < filenames.size( ) ; i++ )
      std::cout << filenames[i] << " has extension : " << extensions[i] << " !\n" ;
   return 0 ;
}

VB: Function fileExt(fname)
	Set fso = CreateObject("Scripting.FileSystemObject")
	Set regex = new regExp
        Dim ret

	regex.pattern = "^[A-Za-z0-9]+$"	
	If regex.test(fso.GetExtensionName(fname)) = False Then
		ret = ""
	Else
		ret = "." & fso.GetExtensionName(fname)
	End If
	fileExt = ret
End Function
 

arr_t = Array("http://example.com/download.tar.gz",	_
	      "CharacterModel.3DS",			_
	      ".desktop",				_
	      "document",				_
	      "document.txt_backup",			_
	      "/etc/pam.d/login")
 
For Each name In arr_t
	Wscript.Echo "NAME:",name
	Wscript.Echo " EXT:","<" & fileExt(name) & ">"
Next
Task: Extract file extension
Go: package main

import "fmt"

func Ext(path string) string {
	for i := len(path) - 1; i >= 0; i-- {
		c := path[i]
		switch {
		case c == '.':
			return path[i:]
		case '0' <= c && c <= '9':
		case 'A' <= c && c <= 'Z':
		case 'a' <= c && c <= 'z':
		default:
			return ""
		}
	}
	return ""
}

func main() {
	type testcase struct {
		input  string
		output string
	}

	tests := []testcase{
		{"http:
		{"CharacterModel.3DS", ".3DS"},
		{".desktop", ".desktop"},
		{"document", ""},
		{"document.txt_backup", ""},
		{"/etc/pam.d/login", ""},
	}

	for _, testcase := range tests {
		ext := Ext(testcase.input)
		if ext != testcase.output {
			panic(fmt.Sprintf("expected %q for %q, got %q",
				testcase.output, testcase.input, ext))
		}
	}
}

Java: public class Test {
 
    public static void main(String[] args) {
        String[] filenames = { "http:
                               "CharacterModel.3DS",
                               ".desktop",
                               "document",
                               "document.txt_backup",
                               "/etc/pam.d/login"
        };

        for (String filename : filenames) {
            String ext = "null";
            int idx = filename.lastIndexOf('.');
            if (idx != -1) {
                String tmp = filename.substring(idx);
                if (tmp.matches("\\.[a-zA-Z0-9]+")) {
                    ext = tmp;
                }
            }
            System.out.println(filename + " -> " + ext);
        }
    }
}
Task: Extract file extension
Java: public class Test {
 
    public static void main(String[] args) {
        String[] filenames = { "http:
                               "CharacterModel.3DS",
                               ".desktop",
                               "document",
                               "document.txt_backup",
                               "/etc/pam.d/login"
        };

        for (String filename : filenames) {
            String ext = "null";
            int idx = filename.lastIndexOf('.');
            if (idx != -1) {
                String tmp = filename.substring(idx);
                if (tmp.matches("\\.[a-zA-Z0-9]+")) {
                    ext = tmp;
                }
            }
            System.out.println(filename + " -> " + ext);
        }
    }
}

VB: Function fileExt(fname)
	Set fso = CreateObject("Scripting.FileSystemObject")
	Set regex = new regExp
        Dim ret

	regex.pattern = "^[A-Za-z0-9]+$"	
	If regex.test(fso.GetExtensionName(fname)) = False Then
		ret = ""
	Else
		ret = "." & fso.GetExtensionName(fname)
	End If
	fileExt = ret
End Function
 

arr_t = Array("http://example.com/download.tar.gz",	_
	      "CharacterModel.3DS",			_
	      ".desktop",				_
	      "document",				_
	      "document.txt_backup",			_
	      "/etc/pam.d/login")
 
For Each name In arr_t
	Wscript.Echo "NAME:",name
	Wscript.Echo " EXT:","<" & fileExt(name) & ">"
Next
Task: Extract file extension
Go: package main

import "fmt"

func Ext(path string) string {
	for i := len(path) - 1; i >= 0; i-- {
		c := path[i]
		switch {
		case c == '.':
			return path[i:]
		case '0' <= c && c <= '9':
		case 'A' <= c && c <= 'Z':
		case 'a' <= c && c <= 'z':
		default:
			return ""
		}
	}
	return ""
}

func main() {
	type testcase struct {
		input  string
		output string
	}

	tests := []testcase{
		{"http:
		{"CharacterModel.3DS", ".3DS"},
		{".desktop", ".desktop"},
		{"document", ""},
		{"document.txt_backup", ""},
		{"/etc/pam.d/login", ""},
	}

	for _, testcase := range tests {
		ext := Ext(testcase.input)
		if ext != testcase.output {
			panic(fmt.Sprintf("expected %q for %q, got %q",
				testcase.output, testcase.input, ext))
		}
	}
}

VB: Function fileExt(fname)
	Set fso = CreateObject("Scripting.FileSystemObject")
	Set regex = new regExp
        Dim ret

	regex.pattern = "^[A-Za-z0-9]+$"	
	If regex.test(fso.GetExtensionName(fname)) = False Then
		ret = ""
	Else
		ret = "." & fso.GetExtensionName(fname)
	End If
	fileExt = ret
End Function
 

arr_t = Array("http://example.com/download.tar.gz",	_
	      "CharacterModel.3DS",			_
	      ".desktop",				_
	      "document",				_
	      "document.txt_backup",			_
	      "/etc/pam.d/login")
 
For Each name In arr_t
	Wscript.Echo "NAME:",name
	Wscript.Echo " EXT:","<" & fileExt(name) & ">"
Next