{"id":3584,"date":"2022-05-19T06:03:20","date_gmt":"2022-05-19T06:03:20","guid":{"rendered":"https:\/\/mdr.foobrdigital.com\/?p=3584"},"modified":"2022-05-19T06:03:20","modified_gmt":"2022-05-19T06:03:20","slug":"dart-runes","status":"publish","type":"post","link":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/2022\/05\/19\/dart-runes\/","title":{"rendered":"Dart Runes"},"content":{"rendered":"\n<p>As we discussed earlier, Dart String is a sequence of characters, letters, numbers, and unique characters. It is the sequence of UTF &#8211; 16 Unicode characters where Dart Runes are the sequence UTF &#8211; 32 Unicode code points. It is a UTF-32 string which is used to print the special symbol. For example &#8211; The theta (\u0398) symbol is signified by using the corresponding Unicode equivalent \\u0398; here &#8216;\\u&#8217; refers to Unicode, and the numbers are in the hexadecimal. Sometimes the hex digits are the more than 4 digits then it should be placed in curly brackets ({}). Let&#8217;s understand it by the following example.<\/p>\n\n\n\n<p><strong>Example &#8211;<\/strong><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void main() {  \n  var heart_rune = '\\u2665';  \n  var theta_rune = '\\u{1f600}';  \n  print(heart_rune);  \n  print(theta_rune);  \n}<\/code><\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#x2665;\n\u0398\n<\/code><\/pre>\n\n\n\n<p>The Dart provides the\u00a0<strong>dart: core<\/strong>\u00a0library which has the\u00a0Dart\u00a0Runes. The String code unit can be retrieved in the following three methods.<\/p>\n\n\n\n<ul><li>Using String.codeUnitAt() Method<\/li><li>Using String.codeUnits property<\/li><li>Using String.runes property<\/li><\/ul>\n\n\n\n<h2 class=\"wp-block-heading\">String.codeUnitAt() Method<\/h2>\n\n\n\n<p>We can access the character&#8217;s code unit in the given string by using the&nbsp;<strong>codeUnitAt()<\/strong>&nbsp;method. It accepts the index position as an argument and returns the 16-bit UTF-16 code unit at the passed index position of the string. The syntax is the given below.<\/p>\n\n\n\n<p><strong>Syntax &#8211;<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void main() {  \n  String str = 'JavaTpoint';  \n  print(\"Welcome to JavaTpoint\");  \n  print(str.codeUnitAt(0));  \n}  <\/code><\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Welcome to JavaTpoint\n74\n<\/code><\/pre>\n\n\n\n<p><strong>Explanation &#8211;<\/strong><\/p>\n\n\n\n<p>In the above code, the variable&nbsp;<strong>str<\/strong>&nbsp;holds string value &#8220;JavaTpoint&#8221;. We called the codeuUnitAt() function and passed index position. It returned the code unit of 0<sup>th<\/sup>&nbsp;index character.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">String.codeUnits Property<\/h2>\n\n\n\n<p>The codeUnits property returns UTF-16 code units for given string in the form of a list. The syntax is given below.<\/p>\n\n\n\n<p><strong>Syntax &#8211;<\/strong><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>String.codeUnits; <\/code><\/pre>\n\n\n\n<p>Let&#8217;s have a look at following example &#8211;<\/p>\n\n\n\n<p><strong>Example &#8211;<\/strong><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void main() {  \n  String str = 'JavaTpoint';  \n  print(\"Welcome to JavaTpoint\");  \n  print(str.codeUnits);  \n}  <\/code><\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>Welcome to JavaTpoint\n&#91;74, 97, 118, 97, 84, 112, 111, 105, 110, 116]\n<\/code><\/pre>\n\n\n\n<p><strong>Explanation &#8211;<\/strong><\/p>\n\n\n\n<p>The codeUnits returned the list of the code unit corresponding to the given character.<\/p>\n\n\n\n<h2 class=\"wp-block-heading\">String.runes Property<\/h2>\n\n\n\n<p>The runes property is used to iterate the given string though the UTF-16 code unit. The Syntax is given below.<\/p>\n\n\n\n<p><strong>Syntax &#8211;<\/strong><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><\/p>\n\n\n\n<ol><li>String.runes&nbsp;&nbsp;<\/li><\/ol>\n\n\n\n<p>Consider the following example.<\/p>\n\n\n\n<p><strong>Example &#8211;<\/strong><\/p>\n\n\n\n<p><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><a href=\"https:\/\/www.javatpoint.com\/dart-runes#\"><\/a><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>void main(){   \n   \"Javapoint\".runes.forEach((int rune) {   \n      var character=new String.fromCharCode(rune);   \n      print(character);   \n   });    \n}  <\/code><\/pre>\n\n\n\n<p><strong>Output:<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>J\na\nv\na\np\no\ni\nn\nt<\/code><\/pre>\n","protected":false},"excerpt":{"rendered":"<p>As we discussed earlier, Dart String is a sequence of characters, letters, numbers, and unique characters. It is the sequence of UTF &#8211; 16 Unicode characters where Dart Runes are the sequence UTF &#8211; 32 Unicode code points. It is a UTF-32 string which is used to print the special symbol. For example &#8211; The [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[917],"tags":[],"_links":{"self":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/3584"}],"collection":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/comments?post=3584"}],"version-history":[{"count":0,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/posts\/3584\/revisions"}],"wp:attachment":[{"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/media?parent=3584"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/categories?post=3584"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/mudassirbackup.infinitycodestudio.com\/index.php\/wp-json\/wp\/v2\/tags?post=3584"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}