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

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.

主站蜘蛛池模板: 土默特左旗| 宁城县| 文登市| 宁强县| 钟山县| 曲松县| 大埔区| 启东市| 银川市| 浙江省| 乳山市| 青海省| 鹤峰县| 安义县| 扎鲁特旗| 和硕县| 金乡县| 乐都县| 静海县| 绥宁县| 湘西| 扎兰屯市| 松溪县| 邳州市| 黄山市| 鹤壁市| 九台市| 镇坪县| 前郭尔| 福泉市| 奉化市| 黑龙江省| 湄潭县| 罗江县| 涡阳县| 武功县| 临邑县| 泾源县| 康平县| 金乡县| 新昌县|