"함수 uppercase()"의 두 판 사이의 차이

12번째 줄: 12번째 줄:
==Bash==
==Bash==
[[category: Bash]]
[[category: Bash]]
<syntaxhighlight lang='bash'>
{{참고|Bash uppercase()}}
<syntaxhighlight lang='bash' run>
echo "Hello, World" | tr 'a-z' 'A-Z'  
echo "Hello, World" | tr 'a-z' 'A-Z'  
# HELLO, WORLD
# HELLO, WORLD

2021년 9월 15일 (수) 15:47 판

1 개요

uc
upcase
upper
uppercase
uppercaseString
strtoupper
toupper
toUpperCase

2 Bash

Bash
Copy
echo "Hello, World" | tr 'a-z' 'A-Z' 
# HELLO, WORLD
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

18 같이 보기

19 References