잔글 (Jmnote 사용자가 함수 uppercase 문서를 함수 uppercase() 문서로 옮겼습니다) |
|||
(사용자 3명의 중간 판 24개는 보이지 않습니다) | |||
1번째 줄: | 1번째 줄: | ||
==개요== | ==개요== | ||
;uc | ;uc | ||
9번째 줄: | 8번째 줄: | ||
;toupper | ;toupper | ||
;toUpperCase | ;toUpperCase | ||
[[분류:대소문자]] | |||
==Bash== | ==Bash== | ||
[[category: Bash]] | [[category: Bash]] | ||
< | {{참고|Bash uppercase()}} | ||
echo "Hello, World" | tr 'a-z' 'A-Z' | <syntaxhighlight lang='bash' run> | ||
echo "Hello, World" | tr 'a-z' 'A-Z' | |||
</ | </syntaxhighlight> | ||
==C== | ==C== | ||
[[category: C]] | [[category: C]] | ||
< | <syntaxhighlight lang="c" run> | ||
#include <ctype.h> | #include <ctype.h> | ||
#include <stdio.h> | #include <stdio.h> | ||
26번째 줄: | 26번째 줄: | ||
int i; | int i; | ||
for (i = 0; i < sizeof(string); ++i) { | for (i = 0; i < sizeof(string); ++i) { | ||
string[i] = toupper(string[i]); | string[i] = toupper(string[i]); | ||
} | } | ||
puts(string); | puts(string); // WIKI MEANS FAST? | ||
return 0; | return 0; | ||
} | } | ||
</ | </syntaxhighlight> | ||
==C++== | |||
{{참고|C++ strtoupper()}} | |||
[[분류: C++]] | |||
<syntaxhighlight lang='cpp' run> | |||
#include <iostream> | |||
using namespace std; | |||
string strtoupper(string str) { | |||
for(auto &c: str) c = toupper(c); | |||
return str; | |||
} | |||
int main() { | |||
string str = "Hello World!"; | |||
string str2 = strtoupper(str); | |||
cout << str << endl; // Hello World! | |||
cout << str2 << endl; // HELLO WORLD! | |||
} | |||
</syntaxhighlight> | |||
<syntaxhighlight lang='cpp' run> | |||
#include <iostream> | |||
#include <algorithm> // transform | |||
using namespace std; | |||
string strtoupper(const string str) { | |||
string ret = str; | |||
transform(ret.begin(), ret.end(),ret.begin(), ::toupper); | |||
return ret; | |||
} | |||
int main() { | |||
string str = "Hello World!"; | |||
string str2 = strtoupper(str); | |||
cout << str << endl; // Hello World! | |||
cout << str2 << endl; // HELLO WORLD! | |||
} | |||
</syntaxhighlight> | |||
==C#== | ==C#== | ||
[[category: Csharp]] | [[category: Csharp]] | ||
< | <syntaxhighlight lang="csharp"> | ||
"Wiki means fast?".ToUpper(); // "WIKI MEANS FAST?" | "Wiki means fast?".ToUpper(); // "WIKI MEANS FAST?" | ||
</ | </syntaxhighlight> | ||
==Excel== | ==Excel== | ||
[[category: Excel]] | [[category: Excel]] | ||
< | <syntaxhighlight lang='php'> | ||
=UPPER("Hello") | =UPPER("Hello") | ||
// HELLO | // HELLO | ||
</ | </syntaxhighlight> | ||
==Go== | |||
[[분류: Go]] | |||
{{참고|Go strings.ToUpper()}} | |||
<syntaxhighlight lang='go' run> | |||
package main | |||
import ( | |||
"fmt" | |||
"strings" | |||
) | |||
func main() { | |||
fmt.Print( strings.ToUpper("hello world") ) | |||
} | |||
</syntaxhighlight> | |||
==Java== | ==Java== | ||
[[category: Java]] | [[category: Java]] | ||
< | <syntaxhighlight lang='java'> | ||
String str = "Hello World!"; | String str = "Hello World!"; | ||
System.out.println(str.toUpperCase()); | System.out.println(str.toUpperCase()); | ||
</ | </syntaxhighlight> | ||
==JavaScript== | ==JavaScript== | ||
[[category: JavaScript]] | [[category: JavaScript]] | ||
< | <syntaxhighlight lang='javascript' run> | ||
var str = "Hello World!"; | var str = "Hello World!"; | ||
console.log( str.toUpperCase() ); | |||
</ | </syntaxhighlight> | ||
==Objective-C== | ==Objective-C== | ||
[[category: Objective-C]] | [[category: Objective-C]] | ||
< | <syntaxhighlight lang='objc'> | ||
NSString *str = @"Hello World!"; | NSString *str = @"Hello World!"; | ||
NSLog(@"%@", [str uppercaseString]; | NSLog(@"%@", [str uppercaseString]; | ||
</ | </syntaxhighlight> | ||
==Perl== | ==Perl== | ||
[[category: Perl]] | [[category: Perl]] | ||
< | <syntaxhighlight lang='perl' run> | ||
$str = "Hello World!"; | $str = "Hello World!"; | ||
print uc($str); | print uc($str); | ||
</ | </syntaxhighlight> | ||
==PHP== | ==PHP== | ||
[[category: PHP]] | [[category: PHP]] | ||
< | <syntaxhighlight lang='php' run> | ||
$str = "Hello World!"; | $str = "Hello World!"; | ||
echo strtoupper($str); | echo strtoupper($str); | ||
</ | </syntaxhighlight> | ||
==Python== | ==Python== | ||
{{참고|파이썬 upper()}} | |||
[[category: Python]] | [[category: Python]] | ||
< | <syntaxhighlight lang='python' run> | ||
str = "Hello World!" | str = "Hello World!" | ||
print str.upper() | print( str.upper() ) | ||
</ | </syntaxhighlight> | ||
==Ruby== | ==Ruby== | ||
[[category: Ruby]] | [[category: Ruby]] | ||
< | <syntaxhighlight lang='ruby' run> | ||
str = "Hello World!" | str = "Hello World!" | ||
str2 = str.upcase | str2 = str.upcase | ||
puts str2 | puts str2 | ||
</ | </syntaxhighlight> | ||
< | <syntaxhighlight lang='ruby' run> | ||
str = "Hello World!" | str = "Hello World!" | ||
str.upcase! | str.upcase! | ||
puts str | puts str | ||
</ | </syntaxhighlight> | ||
==Scheme== | ==Scheme== | ||
[[category: Scheme]] | [[category: Scheme]] | ||
< | <syntaxhighlight lang="scheme"> | ||
(use-modules (srfi srfi-13)) | (use-modules (srfi srfi-13)) | ||
(string-upcase "Wiki means fast?") ; "WIKI MEANS FAST?" | (string-upcase "Wiki means fast?") ; "WIKI MEANS FAST?" | ||
</ | </syntaxhighlight> | ||
==Windows Batch== | |||
<syntaxhighlight lang='batch'> | |||
@echo off | |||
setlocal | |||
set str2= | |||
set "str=Hello World!" | |||
for /f "skip=2 delims=" %%I in ('tree "\%str%"') do if not defined str2 set "str2=%%~I" | |||
set "str2=%str2:~3%" | |||
echo %str2% | |||
</syntaxhighlight> | |||
==SQL== | ==SQL== | ||
113번째 줄: | 173번째 줄: | ||
===MySQL=== | ===MySQL=== | ||
[[category: MySQL]] | [[category: MySQL]] | ||
< | <syntaxhighlight lang='sql'> | ||
SELECT UPPER( "Hello World" ); | SELECT UPPER( "Hello World" ); | ||
-- HELLO WORLD | -- HELLO WORLD | ||
</ | </syntaxhighlight> | ||
===Oracle=== | ===Oracle=== | ||
[[category: Oracle]] | [[category: Oracle]] | ||
< | <syntaxhighlight lang='sql'> | ||
SELECT UPPER('Hello World') FROM DUAL; | SELECT UPPER('Hello World') FROM DUAL; | ||
-- HELLO WORLD | -- HELLO WORLD | ||
</ | </syntaxhighlight> | ||
==같이 보기== | ==같이 보기== | ||
*[[lowercase]] | *[[함수 lowercase()]] | ||
*[[capitalize]] | *[[함수 capitalize()]] | ||
*[[함수 isUppercase()]] | |||
*[[SQL 함수]] | *[[SQL 함수]] | ||
==References== | ==References== | ||
*http://eqcode.com/wiki/uppercase | *http://eqcode.com/wiki/uppercase | ||
*https://stackoverflow.com/questions/34713621/batch-converting-variable-to-uppercase |
2023년 9월 17일 (일) 16:46 기준 최신판
1 개요[ | ]
- uc
- upcase
- upper
- uppercase
- uppercaseString
- strtoupper
- toupper
- toUpperCase
2 Bash[ | ]

Bash
Copy
echo "Hello, World" | tr 'a-z' 'A-Z'
Loading
3 C[ | ]
C
Copy
#include <ctype.h>
#include <stdio.h>
int main(void) {
char string[] = "Wiki means fast?";
int i;
for (i = 0; i < sizeof(string); ++i) {
string[i] = toupper(string[i]);
}
puts(string); // WIKI MEANS FAST?
return 0;
}
Loading
4 C++[ | ]

C++
Copy
#include <iostream>
using namespace std;
string strtoupper(string str) {
for(auto &c: str) c = toupper(c);
return str;
}
int main() {
string str = "Hello World!";
string str2 = strtoupper(str);
cout << str << endl; // Hello World!
cout << str2 << endl; // HELLO WORLD!
}
Loading
C++
Copy
#include <iostream>
#include <algorithm> // transform
using namespace std;
string strtoupper(const string str) {
string ret = str;
transform(ret.begin(), ret.end(),ret.begin(), ::toupper);
return ret;
}
int main() {
string str = "Hello World!";
string str2 = strtoupper(str);
cout << str << endl; // Hello World!
cout << str2 << endl; // HELLO WORLD!
}
Loading
5 C#[ | ]
C#
Copy
"Wiki means fast?".ToUpper(); // "WIKI MEANS FAST?"
6 Excel[ | ]
PHP
Copy
=UPPER("Hello")
// HELLO
7 Go[ | ]

Go
Copy
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Print( strings.ToUpper("hello world") )
}
Loading
8 Java[ | ]
Java
Copy
String str = "Hello World!";
System.out.println(str.toUpperCase());
9 JavaScript[ | ]
JavaScript
Copy
var str = "Hello World!";
console.log( str.toUpperCase() );
▶ | HELLO WORLD! |
10 Objective-C[ | ]
Objective-C
Copy
NSString *str = @"Hello World!";
NSLog(@"%@", [str uppercaseString];
11 Perl[ | ]
Perl
Copy
$str = "Hello World!";
print uc($str);
Loading
12 PHP[ | ]
PHP
Copy
$str = "Hello World!";
echo strtoupper($str);
Loading
13 Python[ | ]

Python
Copy
str = "Hello World!"
print( str.upper() )
Loading
14 Ruby[ | ]
Ruby
Copy
str = "Hello World!"
str2 = str.upcase
puts str2
Loading
Ruby
Copy
str = "Hello World!"
str.upcase!
puts str
Loading
15 Scheme[ | ]
scheme
Copy
(use-modules (srfi srfi-13))
(string-upcase "Wiki means fast?") ; "WIKI MEANS FAST?"
16 Windows Batch[ | ]
batch
Copy
@echo off
setlocal
set str2=
set "str=Hello World!"
for /f "skip=2 delims=" %%I in ('tree "\%str%"') do if not defined str2 set "str2=%%~I"
set "str2=%str2:~3%"
echo %str2%
17 SQL[ | ]
17.1 MySQL[ | ]
sql
Copy
SELECT UPPER( "Hello World" );
-- HELLO WORLD
17.2 Oracle[ | ]
sql
Copy
SELECT UPPER('Hello World') FROM DUAL;
-- HELLO WORLD