Comment detail

LL Golf Hole 2 - 文字列に含まれる単語の最初の文字を大文字にする (Nested Flatten)

pure bashで。golfじゃないですね。

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
l=(a b c d e f g h i j k l m n o p q r s t u v w x y z)
u=(A B C D E F G H I J K L M N O P Q R S T U V W X Y Z)
while read s;do
  set $s
  for w;do
    c=${w:0:1}
    for ((i=0;i<26;i++));do
      if [ $c = ${l[$i]} ];then c=${u[$i]};break;fi
    done
    echo -n "$c${w:1} "
  done
  echo
done

Index

Feed

Other

Link

Pathtraq

loading...