String To Lower Case
From SwiftAPI
Contents |
C
int tolower( int c );
char a[] = "HELLO world"; int len = strlen(a); for(int i = 0; i < len; i++) { a[i] = tolower(a[i]); } // a == "hello world"
C++
#include <cctype> #include <algorithm> #include <string> using namespace std; string a = "HELLO world"; transform(a.begin(), a.end(), a.begin(), (int(*)(int))tolower); // a == "hello world"
C#
System.String : public string ToLower()
string a = "HELLO world"; string b = a.ToLower(); // b == "hello world"
Java
java.lang.String : public String toLowerCase()
String a = "HELLO world"; String b = a.toLowerCase(); // b == "hello world"
JavaScript
var a = "HELLO world"; var b = a.toLowerCase(); // b == "hello world"
Objective-C
@property(readonly, copy) NSString *lowercaseString
NSString *a = @"HELLO world"; NSString *b = a.lowercaseString; // b == "hello world"
Perl
lc EXPR
$a = "HELLO world"; $b = lc($a); # $b == "hello world"
PHP
string strtolower ( string $str )
$a = "HELLO world"; $b = strtolower($a); // $b == "hello world"
Python
str.lower()
a = "HELLO world" b = a.lower() # b == "hello world"
Ruby
str.downcase => new_str
a = "HELLO world" b = a.downcase # b == "hello world" # Or modify the instance directly a = "HELLO world" a.downcase! # a == "hello world"
Swift
import Foundation let a = "HELLO world" let b = a.lowercaseString // b == "hello world"
Visual Basic .NET
System.String : Public Function ToLower As String
Dim a As String = "HELLO world" Dim b As String b = a.ToLower() ' b == "hello world"