deleted = "O" result = data .find_all{|s| !s.start_with? deleted} .sort{|l, r| l.size <=> r.size} Ruby var data = new[] { "Apple", "Microsoft", "Google", "Oracle", "Dell" }; var deleted = "O"; var result = from s in data where !s.StartsWith(deleted) orderby s.Length select s; var data = new[] { "Apple", "Microsoft", "Google", "Oracle", "Dell" }; var deleted = "O"; var result = data .Where(s => !s.StartsWith(deleted)) .OrderBy(s => s.Length); Dim data = New String() {"Apple", "Microsoft", "Google", "Oracle", "Dell"} Dim deleted = "O“ Dim result = From s In data Where Not s.StartsWith(deleted) Order By s.Length Select s C# C# (メソッド構文) Visual Basic 最近の言語は、CよりSQLに近い形で書けるものが多いです。 $data = array('Apple', 'Microsoft', 'Google', 'Oracle', 'Dell'); $deleted = 'O'; $result = array_filter($data, function($s) use ($deleted){return substr($s, 0, 1) != $deleted;}); usort($result, function($l, $r){return strlen($l) - strlen($r);}); PHP 25 List<String> data = Arrays.asList("Apple", "Microsoft", "Google", "Oracle", "Dell"); String deleted = "O"; Stream<String> result = data.stream() .filter(s -> !s.startsWith(deleted)) .sorted((l, r)->l.length() - r.length()); Java data = ['Apple', 'Microsoft', 'Google', 'Dell', 'Oracle'] deleted = 'O' result = [x for x in sorted(data, key=len) if not x.startswith(deleted)] Python @data = qw/Apple Microsoft Google Dell Oracle/; $deleted = "O"; @result = sort {length $a <=> length $b} (grep /^[^$deleted].*/, @data); Perl