Contents [hide]
输出结果
abc
程式码
C
1 2 3 4 5 6 7 8 9 10 11 12 13 | #include <stdio.h> #include <ctype.h> int main () { int i = 0; char str[] = "ABC" ; while ( str[i] ) { str[i] = tolower (str[i]); i++; } printf ( "%s\n" , str); return (0); } |
C++
1 2 3 4 5 6 7 8 9 10 11 12 13 | #include <iostream> #include <cstdlib> #include <algorithm> #include <string> int main ( int argc, char *argv[]) { std::string s( "ABC" ); transform (s.begin (), s.end (), s.begin (), tolower ); std::cout << s << std::endl; :: exit (EXIT_SUCCESS); } |
Java
1 2 3 4 5 6 | public class Lower { public static void main(String[] args) { String str = "ABC" ; System.out.println( str.toLowerCase() ); } } |
JavaScript
1 2 | let str = "ABC" ; console.log(str.toLowerCase()); |
PHP
1 2 3 | <?php $str = "ABC" ; print ( strtolower ( $str ). "\n" ); |
Perl
1 2 | my $str = "ABC" ; print ( lc ( $str ). "\n" ); |
Python
1 2 | str = "ABC" print ( str .lower()) |
Ruby
1 2 | str = "ABC" print(str.downcase() + "\n" ) |

作者: 栗田 創。1st Class, inc的首席执行官/首席技术官。搜索引擎工程师、网站管理员
证书: AWS Solution Architect,Professional Scrum Master I ,一级IT工程师(日本国家证书),TOEIC900+,东京大学経済学部経営学科卒业
请关注我的Weblio帐户以获取更新
IT相关服务:VPS排名