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

 
(사용자 3명의 중간 판 28개는 보이지 않습니다)
1번째 줄: 1번째 줄:
[[category:string]]
==개요==
==개요==
;downcase
;downcase
;lc
;lc
;lower
;lower()
;lowercase
;lowercase()
;lowercaseString
;lowercaseString
;strtolower
;strtolower()
;tolower
;tolower
;toLowerCase
;toLowerCase
*Definition: lowercase(string) returns string  
*Definition: lowercase(string) returns string  
*Description: Returns the string in lower case.
*Description: Returns the string in lower case.
[[분류:대소문자]]


==Bash==
==Bash==
[[category: Bash]]
[[category: Bash]]
<source lang='bash'>
{{참고|Bash lowercase()}}
<syntaxhighlight lang='bash' run>
echo "Hello, World" | tr 'A-Z' 'a-z'
echo "Hello, World" | tr 'A-Z' 'a-z'
# hello, world
</syntaxhighlight>
</source>


==C==
==C==
[[category: C]]
[[category: C]]
<source lang="c">
<syntaxhighlight lang="c" run>
#include <ctype.h>
#include <ctype.h>
#include <stdio.h>
#include <stdio.h>
28번째 줄: 28번째 줄:
     int i;
     int i;
     for (i = 0; i < sizeof(string); ++i) {
     for (i = 0; i < sizeof(string); ++i) {
        /* transform characters in place, one by one */
         string[i] = tolower(string[i]);
         string[i] = tolower(string[i]);
     }
     }
     puts(string);                       /* "wiki means fast?" */
     puts(string); // wiki means fast?
     return 0;
     return 0;
}
}
</source>
</syntaxhighlight>
 
==C++==
[[분류: C++]]
{{참고|C++ strtolower()}}
<syntaxhighlight lang='cpp'>
#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
}
</syntaxhighlight>
<syntaxhighlight lang='cpp'>
#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
}
</syntaxhighlight>


==C#==
==C#==
[[category: Csharp]]
[[category: Csharp]]
<source lang="csharp">
<syntaxhighlight lang="csharp">
"Wiki means fast?".ToLower();        // "wiki means fast?"  
"Wiki means fast?".ToLower();        // "wiki means fast?"  
</source>
</syntaxhighlight>


==Excel==
==Excel==
[[category: Excel]]
[[category: Excel]]
<source lang='php'>
<syntaxhighlight lang='php'>
=LOWER("HELLO")
=LOWER("HELLO")
// hello
// hello
</source>
</syntaxhighlight>
 
==Go==
[[category: Go]]
{{참고|Go strings.ToLower() }}
<syntaxhighlight lang='go' run>
package main
import (
"fmt"
"strings"
)
func main() {
fmt.Print( strings.ToLower("HELLO") )
}
</syntaxhighlight>


==Java==
==Java==
[[category: Java]]
[[category: Java]]
<source lang='java'>
<syntaxhighlight lang='java' run>
String str = "Hello World!";
class MyClass {
System.out.println(str.toLowerCase());
    public static void main(String[] args) {
</source>
        String str = "Hello World!";
        System.out.println(str.toLowerCase());
    }
}
</syntaxhighlight>


==JavaScript==
==JavaScript==
[[category: JavaScript]]
[[category: JavaScript]]
<source lang='javascript'>
<syntaxhighlight lang='javascript' run>
var str = "Hello World!";
var str = "Hello World!";
document.write(str.toLowerCase());
console.log(str.toLowerCase());
</source>
</syntaxhighlight>


==Objective-C==
==Objective-C==
[[category: Objective-C]]
[[category: Objective-C]]
<source lang='objc'>
<syntaxhighlight lang='objc'>
NSString *str = @"Hello World!";
NSString *str = @"Hello World!";
NSLog(@"%@", [str lowercaseString];
NSLog(@"%@", [str lowercaseString];
</source>
</syntaxhighlight>


==Perl==
==Perl==
[[category: Perl]]
[[category: Perl]]
<source lang='perl'>
<syntaxhighlight lang='perl' run>
$str = "Hello World!";
$str = "Hello World!";
print lc($str);
print lc($str);
</source>
</syntaxhighlight>


==PHP==
==PHP==
[[category: PHP]]
[[category: PHP]]
{{참고|PHP strtolower()}}
{{참고|PHP strtolower()}}
<source lang='php'>
<syntaxhighlight lang='php' run>
$str = "Hello World!";
echo strtolower( "Hello World!" ); # hello world!
echo strtolower($str);
</syntaxhighlight>
</source>


==Python==
==Python==
[[category: Python]]
[[category: Python]]
<source lang='python'>
{{참고|Python .lower()}}
str = "Hello World!"
<syntaxhighlight lang='python' run>
print str.lower()
s = "Hello World!"
</source>
print( s.lower() )
</syntaxhighlight>


==Ruby==
==Ruby==
[[category: Ruby]]
[[category: Ruby]]
<source lang='ruby'>
<syntaxhighlight lang='ruby' run>
str = "Hello World!"
str = "Hello World!"
str2 = str.downcase
str2 = str.downcase
puts str2
puts str2
</source>
</syntaxhighlight>
<source lang='ruby'>
<syntaxhighlight lang='ruby' run>
str = "Hello World!"
str = "Hello World!"
str.downcase!
str.downcase!
puts str
puts str
</source>
</syntaxhighlight>


==Scheme==
==Scheme==
[[category: Scheme]]
[[category: Scheme]]
<source lang="scheme">
<syntaxhighlight lang="scheme">
(use-modules (srfi srfi-13))
(use-modules (srfi srfi-13))
(string-downcase "Wiki means fast?") ;  "wiki means fast?"
(string-downcase "Wiki means fast?") ;  "wiki means fast?"
</source>
</syntaxhighlight>
 
==Windows Batch==
<syntaxhighlight lang='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
</syntaxhighlight>


==SQL==
==SQL==
116번째 줄: 187번째 줄:
===MySQL===
===MySQL===
[[category: MySQL]]
[[category: MySQL]]
<source lang='sql'>
<syntaxhighlight lang='mysql' run>
SELECT LOWER( "HELLO WORLD" );
SELECT LOWER( "HELLO WORLD" ); -- hello world
-- hello world
</syntaxhighlight>
</source>


===Oracle===
===Oracle===
[[category: Oracle]]
[[category: Oracle]]
<source lang='sql'>
<syntaxhighlight lang='sql'>
SELECT LOWER('HELLO WORLD') FROM DUAL;
SELECT LOWER('HELLO WORLD') FROM DUAL;
-- hello world
-- hello world
</source>
</syntaxhighlight>
 
==SQLite==
[[분류: SQLite]]
<syntaxhighlight lang='sqlite3' run>
SELECT LOWER( "HELLO WORLD" ); -- hello world
</syntaxhighlight>


==같이 보기==
==같이 보기==
135번째 줄: 211번째 줄:
==References==
==References==
*http://eqcode.com/wiki/lowercase
*http://eqcode.com/wiki/lowercase
*http://www.robvanderwoude.com/battech_convertcase.php

2023년 9월 17일 (일) 16:45 기준 최신판

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'

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) {
        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 Go[ | ]

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

8 Java[ | ]

class MyClass {
    public static void main(String[] args) {
        String str = "Hello World!";
        System.out.println(str.toLowerCase());
    }
}

9 JavaScript[ | ]

var str = "Hello World!";
console.log(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[ | ]

s = "Hello World!"
print( s.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 SQLite[ | ]

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

19 같이 보기[ | ]

20 References[ | ]