함수 uppercase()


개요

uc
upcase
upper
uppercase
uppercaseString
strtoupper
toupper
toUpperCase

Bash

echo "Hello, World" | tr 'a-z' 'A-Z'

C

#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;
}

C++

#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!
}
#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!
}

C#

"Wiki means fast?".ToUpper();        // "WIKI MEANS FAST?"

Excel

=UPPER("Hello")
// HELLO

Go

package main
import (
	"fmt"
	"strings"
)
func main() {
	fmt.Print( strings.ToUpper("hello world") )
}

Java

String str = "Hello World!";
System.out.println(str.toUpperCase());

JavaScript

var str = "Hello World!";
console.log( str.toUpperCase() );

Objective-C

NSString *str = @"Hello World!";
NSLog(@"%@", [str uppercaseString];

Perl

$str = "Hello World!";
print uc($str);

PHP

$str = "Hello World!";
echo strtoupper($str);

Python

str = "Hello World!"
print( str.upper() )

Ruby

str = "Hello World!"
str2 = str.upcase
puts str2
str = "Hello World!"
str.upcase!
puts str

Scheme

(use-modules (srfi srfi-13))
(string-upcase "Wiki means fast?") ;  "WIKI MEANS FAST?"

Windows 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%

SQL

MySQL

SELECT UPPER( "Hello World" );
-- HELLO WORLD

Oracle

SELECT UPPER('Hello World') FROM DUAL;
-- HELLO WORLD

같이 보기

References