반응형
정확히 어떤 때라고 말씀드리기는 어렵지만 코딩을 하다 보니 가끔씩 알파벳 인덱스가 필요한 경우가 종종 있었습니다. 그래서 오늘은 Powershell 을 사용하여 알파벳 대소문자를 찍는 방법에 대해서 소개를 해 보려고 합니다.
아시는 바와 같이 알파벳 대문자 A는 아스키코드로 65고~ 소문자 a는 97 부터 시작을 하게 됩니다. A부터 Z까지 전체 알파벳은 26 개 이므로 시작하는 숫자로 부터 26개를 찍어주면 될 것입니다.
코드는 아래와 같고~
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function Alphabet-Upper | |
{ | |
$UpperAlph=@() | |
65..90|foreach-object{$UpperAlph+=[char]$_} | |
return $UpperAlph | |
} | |
function Alphabet-Lower | |
{ | |
$LowerAlph=@() | |
97..122|foreach-object{$LowerAlph+=[char]$_} | |
return $LowerAlph | |
} | |
Powershell 에서 실행해 보면 아래와 같이 알파벳 대소문자가 찍히는 것을 확인할 수 있습니다.
반응형
'programming language > powershell' 카테고리의 다른 글
Windows 10 오피스허브 삭제 Powershell 스크립트 (0) | 2021.09.12 |
---|---|
Powershell 특정 만든이가 만든 예약 작업 삭제하는 방법 (0) | 2021.08.26 |
Powershell 날짜 간격 계산 (0) | 2020.01.14 |
Powershell switch case regular expression 사용 (0) | 2019.07.14 |
Windows 7 Powershell version update (0) | 2019.04.29 |
Powershell 스크립트 실행 시간 측정 (0) | 2019.04.22 |
Powershell string to Ascii Code (0) | 2019.04.17 |
Powershell Tuple 사용 방법 System.Tuple .NET Framework class (0) | 2019.04.08 |
댓글