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

100번째 줄: 100번째 줄:
==JavaScript==
==JavaScript==
[[category: JavaScript]]
[[category: JavaScript]]
<syntaxhighlight lang='javascript' run>
<syntaxhighlight lang='javascript'>
var str = "Hello World!";
var str = "Hello World!";
document.write(str.toLowerCase());
document.write(str.toLowerCase());

2021년 5월 1일 (토) 01:10 판

1 개요

downcase
lc
lower()
lowercase()
lowercaseString
strtolower()
tolower
toLowerCase
  • Definition: lowercase(string) returns string
  • Description: Returns the string in lower case.

2 Bash

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

3 C

#include <ctype.h>
#include <stdio.h>
int main(void) {
    char string[] = "Wiki means fast?";
    int i;
    for (i = 0; i < sizeof(string); ++i) {
        /* transform characters in place, one by one */ 
        string[i] = tolower(string[i]);
    }
    puts(string);                       /* "wiki means fast?" */
    return 0;
}

4 C++

#include <iostream>
using namespace std;
string strtolower(string str) {
    for(auto &c: str) c = tolower(c);
    return str;
}
int main() {
    cout << strtolower("Hello World") << endl; // hello world
}
#include <iostream>
#include <algorithm> // transform
using namespace std;
string strtolower(const string str) {
    string ret = str;
    transform(ret.begin(), ret.end(),ret.begin(), ::tolower);
    return ret;
}
int main() {
    cout << strtolower("Hello World") << endl; // hello world
}

5 C#

"Wiki means fast?".ToLower();        // "wiki means fast?"

6 Excel

=LOWER("HELLO")
// hello

7 Excel

package main
import (
	"fmt"
	"strings"
)
func main() {
	fmt.Print( strings.ToLower("HELLO") )
}

8 Java

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

9 JavaScript

var str = "Hello World!";
document.write(str.toLowerCase());

10 Objective-C

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

11 Perl

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

12 PHP

echo strtolower( "Hello World!" );
# hello world!

13 Python

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

14 Ruby

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

15 Scheme

(use-modules (srfi srfi-13))
(string-downcase "Wiki means fast?") ;  "wiki means fast?"

16 Windows Batch

@ECHO OFF
SETLOCAL ENABLEDELAYEDEXPANSION

SET _SAMPLE=Hello, World

CALL :LCase _SAMPLE _RESULTS
ECHO.%_RESULTS%

ENDLOCAL
GOTO:EOF

:LCase
SET _UCase=A B C D E F G H I J K L M N O P Q R S T U V W X Y Z
SET _LCase=a b c d e f g h i j k l m n o p q r s t u v w x y z
SET _Lib_UCase_Tmp=!%1!
IF /I "%0"==":UCase" SET _Abet=%_UCase%
IF /I "%0"==":LCase" SET _Abet=%_LCase%
FOR %%Z IN (%_Abet%) DO SET _Lib_UCase_Tmp=!_Lib_UCase_Tmp:%%Z=%%Z!
SET %2=%_Lib_UCase_Tmp%
GOTO:EOF

REM hello, world

17 SQL

17.1 MySQL

SELECT LOWER( "HELLO WORLD" );
-- hello world

17.2 Oracle

SELECT LOWER('HELLO WORLD') FROM DUAL;
-- hello world

18 같이 보기

19 References