官术网_书友最值得收藏!

Strings

Just as in Java, strings are immutable. String literals can be created using double quotes or triple quotes. Double quotes create an escaped string. In an escaped string, special characters, such as new line, must be escaped:

    val string = "string with \n new line" 

Triple quotes create a raw string. In a raw string, no escaping is necessary, and all characters can be included:

    val rawString = """ 
    raw string is super useful for strings that span many lines """ 

Strings also provide an iterator function that can be used in a for loop. This will be described later in the Loops section.

主站蜘蛛池模板: 藁城市| 大渡口区| 津市市| 嘉义市| 沙湾县| 敦煌市| 罗江县| 武平县| 清徐县| 吉木乃县| 定南县| 宣汉县| 庆安县| 荔波县| 任丘市| 乡城县| 黑龙江省| 永靖县| 奉化市| 郧西县| 泸西县| 伊宁县| 如皋市| 恩平市| 武义县| 西充县| 运城市| 临泉县| 昌邑市| 蕉岭县| 胶州市| 南平市| 建阳市| 克什克腾旗| 潍坊市| 鹤岗市| 尉犁县| 大方县| 巢湖市| 紫阳县| 新宁县|