Skip to content

Instantly share code, notes, and snippets.

@komasaru
Created May 14, 2017 08:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save komasaru/5b5417ac3b16779d49e4365c84413a68 to your computer and use it in GitHub Desktop.
Save komasaru/5b5417ac3b16779d49e4365c84413a68 to your computer and use it in GitHub Desktop.
Fortran code to convert chars to uppercase.
!****************************************************
! 英小文字->英大文字 変換
! : 入力文字列の英小文字を全て英大文字に変換して出力する
!
! date name version
! 2017.05.14 mk-mode.com 1.00 新規作成
!
! Copyright(C) 2017 mk-mode.com All Rights Reserved.
!****************************************************
!
program to_uppercase
implicit none
integer i
character(len=100) line
print *, "英文を入力してください(100文字超は切り捨て):"
read '(a)', line
do i = 1, len_trim(line)
if (line(i:i) >= 'a' .and. line(i:i) <= 'z') then
line(i:i) = char(ichar(line(i:i)) - 32)
end if
end do
print '(a)', trim(line)
end program to_uppercase
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment