Interfaces
interface UnicodeRuneExtension
public interface UnicodeRuneExtension {
func isLetter(): Bool
func isLowerCase(): Bool
func isNumber(): Bool
func isTitleCase(): Bool
func isUpperCase(): Bool
func isWhiteSpace(): Bool
func toLowerCase(): Rune
func toLowerCase(opt: CasingOption): Rune
func toTitleCase(): Rune
func toTitleCase(opt: CasingOption): Rune
func toUpperCase(): Rune
func toUpperCase(opt: CasingOption): Rune
}
Description: Specifies an interface for extending the Unicode character set for other types.
It can be used to add extension functions related to the Unicode character set for the Rune type, including character type recognition, character case conversion, and whitespace character deletion.
func isLetter()
func isLetter(): Bool
Description: Checks whether a character type is Unicode letter.
Returns:
- Bool: If the character type is
Unicodeletter,trueis returned. Otherwise,falseis returned.
func isLowerCase()
func isLowerCase(): Bool
Description: Checks whether a character type is Unicode lowercase letter.
Returns:
- Bool: If the character type is
Unicodelowercase letter,trueis returned. Otherwise,falseis returned.
func isNumber()
func isNumber(): Bool
Description: Checks whether a character type is Unicode number.
Returns:
- Bool: If the character type is
Unicodenumber,trueis returned. Otherwise,falseis returned.
func isTitleCase()
func isTitleCase(): Bool
Description: Checks whether a character type is Unicode titlecase letter.
The Unicode titlecase letters refer to a special form of letters that are used to represent the first capitalized letter of each word in a title in some languages. These letters are represented by special characters, such as U+01C5 (Dž) and U+01F1 (DZ). These characters are usually used in some Eastern European languages, such as Croatian and Serbian.
Titlecase letters include 0x01C5, 0x01C8, 0x01CB, 0x01F2, 0x1F88–0x1F8F, 0x1F98–0x1F9F, 0x1F98–0x1F9F, 0x1FA8–0x1FAF, 0x1FBC, 0x1FCC, and 0x1FFC.
Returns:
- Bool: If the character type is
Unicodetitlecase letter,trueis returned. Otherwise,falseis returned.
func isUpperCase()
func isUpperCase(): Bool
Description: Checks whether a character type is Unicode uppercase letter.
Returns:
- Bool: If the character type is
Unicodeuppercase letter,trueis returned. Otherwise,falseis returned.
func isWhiteSpace()
func isWhiteSpace(): Bool
Description: Checks whether a character type is Unicode whitespace character.
Whitespace characters include 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x0020, 0x0085, 0x00A0, 0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029, 0x202F, 0x205F, and 0x3000.
Returns:
- Bool: If the character type is
Unicodewhitespace character,trueis returned. Otherwise,falseis returned.
func toLowerCase()
func toLowerCase(): Rune
Description: Obtains the Unicode lowercase letter of a type.
Returns:
- Rune: lowercase letter of the current type
func toTitleCase()
func toTitleCase(): Rune
Description: Obtains the Unicode titlecase letter of a type.
Returns:
- Rune: titlecase letter of the current type
func toUpperCase()
func toUpperCase(): Rune
Description: Obtains the Unicode uppercase letter of a type.
Returns:
- Rune: uppercase letter of the current type
func toLowerCase(CasingOption)
func toLowerCase(opt: CasingOption): Rune
Description: Obtains the Unicode lowercase letter of a type.
Parameters:
- opt: CasingOption: passed language enumeration objects
Returns:
- Rune: lowercase letter of the current type
func toTitleCase(CasingOption)
func toTitleCase(opt: CasingOption): Rune
Description: Obtains the Unicode titlecase letter of a type.
Parameters:
- opt: CasingOption: passed language enumeration objects
Returns:
- Rune: titlecase letter of the current type
func toUpperCase(CasingOption)
func toUpperCase(opt: CasingOption): Rune
Description: Obtains the Unicode uppercase letter of a type.
Parameters:
- opt: CasingOption: passed language enumeration objects
Returns:
- Rune: uppercase letter of the current type
extend Rune <: UnicodeRuneExtension
extend Rune <: UnicodeRuneExtension
Description: Extends the UnicodeRuneExtension interface for the Rune type to support operations related to the character set.
Parent types:
func isLetter()
public func isLetter(): Bool
Description: Checks whether a character is a Unicode letter.
Returns:
- Bool: If the character is a
Unicodeletter,trueis returned. Otherwise,falseis returned.
Examples:
import std.unicode.*
main(): Unit {
println(r'a'.isLetter())
println(r'1'.isLetter())
}
Results:
true
false
func isLowerCase()
public func isLowerCase(): Bool
Description: Checks whether a character is a Unicode lowercase letter.
Returns:
- Bool: If the character is a
Unicodelowercase letter,trueis returned. Otherwise,falseis returned.
Examples:
import std.unicode.*
main(): Unit {
println(r'a'.isLowerCase())
println(r'A'.isLowerCase())
}
Results:
true
false
func isNumber()
public func isNumber(): Bool
Description: Checks whether a character is a Unicode number.
Returns:
- Bool: If the character is a
Unicodenumber,trueis returned. Otherwise,falseis returned.
Examples:
import std.unicode.*
main(): Unit {
println(r'a'.isNumber())
println(r'1'.isNumber())
}
Results:
false
true
func isTitleCase()
public func isTitleCase(): Bool
Description: Checks whether a character is a Unicode titlecase letter.
The Unicode titlecase letters refer to a special form of letters that are used to represent the first capitalized letter of each word in a title in some languages. These letters are represented by special characters, such as U+01C5 (Dž) and U+01F1 (DZ). These characters are usually used in some Eastern European languages, such as Croatian and Serbian.
Titlecase letters include 0x01C5, 0x01C8, 0x01CB, 0x01F2, 0x1F88–0x1F8F, 0x1F98–0x1F9F, 0x1F98–0x1F9F, 0x1FA8–0x1FAF, 0x1FBC, 0x1FCC, and 0x1FFC.
Returns:
- Bool: If the character is a
Unicodetitlecase letter,trueis returned. Otherwise,falseis returned.
Examples:
import std.unicode.*
main(): Unit {
println(r'Dž'.isTitleCase())
}
Results:
true
func isUpperCase()
public func isUpperCase(): Bool
Description: Checks whether a character is a Unicode uppercase letter.
Returns:
- Bool: If the character is a
Unicodeuppercase letter,trueis returned. Otherwise,falseis returned.
Examples:
import std.unicode.*
main(): Unit {
println(r'a'.isUpperCase())
println(r'A'.isUpperCase())
}
Results:
false
true
func isWhiteSpace()
public func isWhiteSpace(): Bool
Description: Checks whether a character is a Unicode whitespace character.
Whitespace characters include 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x0020, 0x0085, 0x00A0, 0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029, 0x202F, 0x205F, and 0x3000.
Returns:
- Bool: If the character is a
Unicodewhitespace character,trueis returned. Otherwise,falseis returned.
Examples:
import std.unicode.*
main(): Unit {
println(r' '.isWhiteSpace())
}
Results:
true
func toLowerCase()
public func toLowerCase(): Rune
Description: Obtains the Unicode lowercase letter of a character.
Returns:
- Rune: lowercase letter of the current character
Examples:
import std.unicode.*
main(): Unit {
println(r'A'.toLowerCase())
}
Results:
a
func toLowerCase(CasingOption)
public func toLowerCase(opt: CasingOption): Rune
Description: Obtains the Unicode lowercase letter of a character.
Parameters:
- opt: CasingOption: passed language enumeration objects
Returns:
- Rune: lowercase letter of the current character
Examples:
import std.unicode.*
main(): Unit {
println(r'A'.toLowerCase(CasingOption.Other))
}
Results:
a
func toTitleCase()
public func toTitleCase(): Rune
Description: Obtains the Unicode titlecase letter of a character.
Returns:
- Rune: titlecase letter of the current character
Examples:
import std.unicode.*
main(): Unit {
println(r'a'.toTitleCase())
}
Results:
A
func toTitleCase(CasingOption)
public func toTitleCase(opt: CasingOption): Rune
Description: Obtains the Unicode titlecase letter of a character.
Parameters:
- opt: CasingOption: passed language enumeration objects
Returns:
- Rune: titlecase letter of the current character
Examples:
import std.unicode.*
main(): Unit {
println(r'a'.toTitleCase(CasingOption.Other))
}
Results:
A
func toUpperCase()
public func toUpperCase(): Rune
Description: Obtains the Unicode uppercase letter of a character.
Returns:
- Rune: uppercase letter of the current character
Examples:
import std.unicode.*
main(): Unit {
println(r'a'.toUpperCase())
}
Results:
A
func toUpperCase(CasingOption)
public func toUpperCase(opt: CasingOption): Rune
Description: Obtains the Unicode uppercase letter of a character.
Parameters:
- opt: CasingOption: passed language enumeration objects
Returns:
- Rune: uppercase letter of the current character
Examples:
import std.unicode.*
main(): Unit {
println(r'a'.toUpperCase(CasingOption.Other))
}
Results:
A
interface UnicodeStringExtension
public interface UnicodeStringExtension {
func isBlank(): Bool
func toLower(): String
func toLower(opt: CasingOption): String
func toTitle(): String
func toTitle(opt: CasingOption): String
func toUpper(): String
func toUpper(opt: CasingOption): String
func trim(): String
func trimEnd(): String
func trimLeft(): String
func trimRight(): String
func trimStart(): String
}
Description: Specifies an interface for extending the Unicode character set for other types.
It can be used to add s related to the Unicode character set for the String type, including character type recognition, character case conversion, and whitespace character deletion.
func isBlank()
func isBlank(): Bool
Description: Checks whether the current string is empty or contains only Unicode whitespace characters.
Whitespace characters include 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x0020, 0x0085, 0x00A0, 0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029, 0x202F, 0x205F, and 0x3000.
Returns:
- Bool: If the string is empty or contains only whitespace characters,
trueis returned. Otherwise,falseis returned.
func toLower()
func toLower(): String
Description: Converts all Unicode uppercase letters in the current string to lowercase letters.
Returns:
- String: lowercase string after conversion
Throws:
- IllegalArgumentException: If the string contains an invalid UTF-8 code, this exception is thrown.
func toLower(CasingOption)
func toLower(opt: CasingOption): String
Description: Converts all Unicode uppercase letters in the current string to lowercase letters.
Parameters:
- opt: CasingOption: passed language enumeration objects
Returns:
- String: lowercase string after conversion
Throws:
- IllegalArgumentException: If the string contains an invalid UTF-8 code, this exception is thrown.
func toTitle()
func toTitle(): String
Description: Converts the Unicode characters that can be converted to titlecase letters in the current string to titlecase letters.
Returns:
- String: titlecase string after conversion
Throws:
- IllegalArgumentException: If the string contains an invalid UTF-8 code, this exception is thrown.
func toTitle(CasingOption)
func toTitle(opt: CasingOption): String
Description: Converts the Unicode characters that can be converted to titlecase letters in the current string to titlecase letters.
Parameters:
- opt: CasingOption: passed language enumeration objects
Returns:
- String: titlecase string after conversion
Throws:
- IllegalArgumentException: If the string contains an invalid UTF-8 code, this exception is thrown.
func toUpper()
func toUpper(): String
Description: Converts all Unicode lowercase letters in the current string to uppercase letters.
Returns:
- String: uppercase string after conversion
Throws:
- IllegalArgumentException: If the string contains an invalid UTF-8 code, this exception is thrown.
func toUpper(CasingOption)
func toUpper(opt: CasingOption): String
Description: Converts all Unicode lowercase letters in the current string to uppercase letters.
Parameters:
- opt: CasingOption: passed language enumeration objects
Returns:
- String: uppercase string after conversion
Throws:
- IllegalArgumentException: If the string contains an invalid UTF-8 code, this exception is thrown.
func trim()
func trim(): String
Description: Trims whitespace characters from the beginning and end of a string. For the definition of whitespace characters, see the extension function isWhiteSpace for the Rune type.
Returns:
- String: new string after leading and trailing whitespace characters are trimmed from the beginning and end of a string
Throws:
- IllegalArgumentException: If the string does not contain any valid UTF-8 code, this exception is thrown.
func trimEnd()
func trimEnd(): String
Description: Trims whitespace characters at the end of a string. For the definition of whitespace characters, see the extension function isWhiteSpace for the Rune type.
Returns:
- String: string after whitespace characters at the end of the string are trimmed
Throws:
- IllegalArgumentException: If the string does not contain any valid UTF-8 code, this exception is thrown.
func trimLeft() (deprecated)
func trimLeft(): String
Description: Trims whitespace characters at the beginning of a string. For the definition of whitespace characters, see the extension function isWhiteSpace for the Rune type.
NOTE
This function will be deprecated in future releases and trimStart will be used instead.
Returns:
- String: string after whitespace characters at the beginning of the string are trimmed
Throws:
- IllegalArgumentException: If the string does not contain any valid UTF-8 code, this exception is thrown.
func trimRight() (deprecated)
func trimRight(): String
Description: Trims whitespace characters at the end of a string. For the definition of whitespace characters, see the extension function isWhiteSpace for the Rune type.
NOTE
This function will be deprecated in future releases and trimEnd will be used instead.
Returns:
- String: string after whitespace characters at the end of the string are trimmed
Throws:
- IllegalArgumentException: If the string does not contain any valid UTF-8 code, this exception is thrown.
func trimStart()
func trimStart(): String
Description: Trims whitespace characters at the beginning of a string. For the definition of whitespace characters, see the extension function isWhiteSpace for the Rune type.
Returns:
- String: string after whitespace characters at the beginning of the string are trimmed
Throws:
- IllegalArgumentException: If the string does not contain any valid UTF-8 code, this exception is thrown.
extend String <: UnicodeStringExtension
extend String <: UnicodeStringExtension
Description: Extends the UnicodeRuneExtension interface for the String type to support operations related to the character set.
Parent types:
func isBlank()
public func isBlank(): Bool
Description: Checks whether the current string is empty or contains only Unicode whitespace characters.
Whitespace characters include 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0x0020, 0x0085, 0x00A0, 0x1680, 0x2000, 0x2001, 0x2002, 0x2003, 0x2004, 0x2005, 0x2006, 0x2007, 0x2008, 0x2009, 0x200A, 0x2028, 0x2029, 0x202F, 0x205F, and 0x3000.
Returns:
- Bool: If the string is empty or contains only whitespace characters,
trueis returned. Otherwise,falseis returned.
Examples:
import std.unicode.*
main(): Unit {
println(" \t\n\r".isBlank())
}
Results:
true
func toLower()
public func toLower(): String
Description: Converts all Unicode uppercase letters in the current string to lowercase letters.
Returns:
- String: lowercase string after conversion
Throws:
- IllegalArgumentException: If the string contains an invalid UTF-8 code, this exception is thrown.
Examples:
import std.unicode.*
main(): Unit {
println("AbcDEF".toLower())
}
Results:
abcdef
func toLower(CasingOption)
public func toLower(opt: CasingOption): String
Description: Converts all Unicode uppercase letters in the current string to lowercase letters.
Parameters:
- opt: CasingOption: passed language enumeration objects
Returns:
- String: lowercase string after conversion
Throws:
- IllegalArgumentException: If the string contains an invalid UTF-8 code, this exception is thrown.
Examples:
import std.unicode.*
main(): Unit {
println("AbcDEF".toLower(CasingOption.Other))
}
Results:
abcdef
func toTitle()
public func toTitle(): String
Description: Converts the Unicode characters that can be converted to titlecase letters in the current string to titlecase letters.
Returns:
- String: titlecase string after conversion
Throws:
- IllegalArgumentException: If the string contains an invalid UTF-8 code, this exception is thrown.
Examples:
import std.unicode.*
main(): Unit {
println("AbcDEF".toTitle())
}
Results:
ABCDEF
func toTitle(CasingOption)
public func toTitle(opt: CasingOption): String
Description: Converts the Unicode characters that can be converted to titlecase letters in the current string to titlecase letters.
Parameters:
- opt: CasingOption: passed language enumeration objects
Returns:
- String: titlecase string after conversion
Throws:
- IllegalArgumentException: If the string contains an invalid UTF-8 code, this exception is thrown.
Examples:
import std.unicode.*
main(): Unit {
println("AbcDEF".toTitle(CasingOption.Other))
}
Results:
ABCDEF
func toUpper()
public func toUpper(): String
Description: Converts all Unicode lowercase letters in the current string to uppercase letters.
Returns:
- String: uppercase string after conversion
Throws:
- IllegalArgumentException: If the string contains an invalid UTF-8 code, this exception is thrown.
Examples:
import std.unicode.*
main(): Unit {
println("AbcDEF".toUpper())
}
Results:
ABCDEF
func toUpper(CasingOption)
public func toUpper(opt: CasingOption): String
Description: Converts all Unicode lowercase letters in the current string to uppercase letters.
Parameters:
- opt: CasingOption: passed language enumeration objects
Returns:
- String: uppercase string after conversion
Throws:
- IllegalArgumentException: If the string contains an invalid UTF-8 code, this exception is thrown.
Examples:
import std.unicode.*
main(): Unit {
println("AbcDEF".toUpper(CasingOption.Other))
}
Results:
ABCDEF
func trim()
public func trim(): String
Description: Trims whitespace characters at the beginning and end of a string. For the definition of whitespace characters, see the extension function isWhiteSpace for the Rune type.
Returns:
- String: string after whitespace characters at the beginning and end of the string are trimmed
Throws:
- IllegalArgumentException: If the string does not contain any valid UTF-8 code, this exception is thrown.
Examples:
import std.unicode.*
main(): Unit {
println("\nx \t ".trim())
}
Results:
x
func trimEnd()
public func trimEnd(): String
Description: Trims whitespace characters at the end of a string. For the definition of whitespace characters, see the extension function isWhiteSpace for the Rune type.
Returns:
- String: string after whitespace characters at the end of the string are trimmed
Throws:
- IllegalArgumentException: If the string does not contain any valid UTF-8 code, this exception is thrown.
Examples:
import std.unicode.*
main(): Unit {
println(" x ".trimEnd())
}
Results:
x
func trimLeft() (deprecated)
public func trimLeft(): String
Description: Trims whitespace characters at the beginning of a string. For the definition of whitespace characters, see the extension function isWhiteSpace for the Rune type.
NOTE
This function will be deprecated in future releases and trimStart will be used instead.
Returns:
- String: string after whitespace characters at the beginning of the string are trimmed
Throws:
- IllegalArgumentException: If the string does not contain any valid UTF-8 code, this exception is thrown.
Examples:
import std.unicode.*
main(): Unit {
println(" x ".trimLeft())
}
Results:
x
func trimRight() (deprecated)
public func trimRight(): String
Description: Trims whitespace characters at the end of a string. For the definition of whitespace characters, see the extension function isWhiteSpace for the Rune type.
NOTE
This function will be deprecated in future releases and trimEnd will be used instead.
Returns:
- String: string after whitespace characters at the end of the string are trimmed
Throws:
- IllegalArgumentException: If the string does not contain any valid UTF-8 code, this exception is thrown.
Examples:
import std.unicode.*
main(): Unit {
println(" x ".trimRight())
}
Results:
x
func trimStart()
public func trimStart(): String
Description: Trims whitespace characters at the beginning of a string. For the definition of whitespace characters, see the extension function isWhiteSpace for the Rune type.
Returns:
- String: string after whitespace characters at the beginning of the string are trimmed
Throws:
- IllegalArgumentException: If the string does not contain any valid UTF-8 code, this exception is thrown.
Examples:
import std.unicode.*
main(): Unit {
println(" x ".trimStart())
}
Results:
x