{"id":5502,"date":"2023-10-21T15:08:49","date_gmt":"2023-10-21T22:08:49","guid":{"rendered":"https:\/\/ioflood.com\/blog\/?p=5502"},"modified":"2024-02-26T13:52:14","modified_gmt":"2024-02-26T20:52:14","slug":"java-string-methods","status":"publish","type":"post","link":"https:\/\/ioflood.com\/blog\/java-string-methods\/","title":{"rendered":"Java String Methods: From Beginner to Expert"},"content":{"rendered":"<div class=\"wp-block-image\">\n<figure class=\"alignright size-full is-resized\"><img decoding=\"async\" src=\"https:\/\/ioflood.com\/blog\/wp-content\/uploads\/2023\/10\/assortment_of_java_string_method_symbols_for_educational_purposes-300x300.jpg\" alt=\"assortment_of_java_string_method_symbols_for_educational_purposes\" width=\"300\" height=\"300\" title=\"\"><\/figure>\n<\/div>\n<p>Are you finding it challenging to work with Java String methods? You&#8217;re not alone. Many developers, both beginners and experienced, often struggle with string manipulation in Java. But, think of the Java String class as a Swiss Army knife, offering a plethora of methods to manipulate strings effectively.<\/p>\n<p><strong>This guide will walk you through the most commonly used methods in the Java String class, from basic to advanced.<\/strong> We&#8217;ll explore the core functionality of these methods, delve into their advanced usage, and even discuss common issues and their solutions.<\/p>\n<p>So, let&#8217;s dive in and start mastering Java String methods!<\/p>\n<h2>TL;DR: How Do I Use Java String Methods?<\/h2>\n<blockquote><p>\n  Java provides a String class packed with many useful methods such as <code>length()<\/code>, <code>charAt()<\/code>, <code>substring()<\/code>, <code>contains()<\/code>, <code>equals()<\/code>, and more. These methods can be used to perform a variety of operations on strings.\n<\/p><\/blockquote>\n<p>Here&#8217;s a simple example of using the <code>length()<\/code> method:<\/p>\n<pre><code class=\"language-java line-numbers\">String str = \"Hello\";\nint len = str.length();\nSystem.out.println(len);\n\n# Output:\n# 5\n<\/code><\/pre>\n<p>In this example, we&#8217;ve created a string <code>str<\/code> with the value &#8216;Hello&#8217;. We then use the <code>length()<\/code> method to get the length of the string, which is 5. The length is then printed to the console.<\/p>\n<blockquote><p>\n  This is just a basic way to use Java String methods, but there&#8217;s so much more to learn about manipulating and analyzing strings in Java. Continue reading for more detailed information and advanced usage examples.\n<\/p><\/blockquote>\n<h2>Exploring Basic Java String Methods<\/h2>\n<p>When it comes to manipulating strings in Java, the String class provides us with several powerful methods. Let&#8217;s take a closer look at some of these basic methods, their uses, and potential pitfalls.<\/p>\n<h3>Understanding the <code>length()<\/code> Method<\/h3>\n<p>The <code>length()<\/code> method returns the length of a specific string. Here&#8217;s how you can use it:<\/p>\n<pre><code class=\"language-java line-numbers\">String str = \"Hello World\";\nint len = str.length();\nSystem.out.println(len);\n\n# Output:\n# 11\n<\/code><\/pre>\n<p>In this example, the string <code>str<\/code> contains &#8216;Hello World&#8217;. When we apply the <code>length()<\/code> method, it returns the length of the string, which is 11.<\/p>\n<h3>Working with the <code>charAt()<\/code> Method<\/h3>\n<p>The <code>charAt()<\/code> method returns the character at a specific index. Here&#8217;s an example:<\/p>\n<pre><code class=\"language-java line-numbers\">String str = \"Hello World\";\nchar ch = str.charAt(0);\nSystem.out.println(ch);\n\n# Output:\n# H\n<\/code><\/pre>\n<p>Here, we used <code>charAt(0)<\/code> to get the first character of the string <code>str<\/code>, which is &#8216;H&#8217;. Remember, string indexing starts from 0 in Java.<\/p>\n<h3>Using the <code>substring()<\/code> Method<\/h3>\n<p>The <code>substring()<\/code> method extracts a particular portion of a string. Let&#8217;s see it in action:<\/p>\n<pre><code class=\"language-java line-numbers\">String str = \"Hello World\";\nString subStr = str.substring(0, 5);\nSystem.out.println(subStr);\n\n# Output:\n# Hello\n<\/code><\/pre>\n<p>In this example, <code>substring(0, 5)<\/code> extracts the substring from index 0 to 4 (end index is exclusive), which gives us &#8216;Hello&#8217;.<\/p>\n<h3>Finding with the <code>contains()<\/code> Method<\/h3>\n<p>The <code>contains()<\/code> method checks if a string contains a specified sequence of characters. Here&#8217;s how to use it:<\/p>\n<pre><code class=\"language-java line-numbers\">String str = \"Hello World\";\nboolean result = str.contains(\"World\");\nSystem.out.println(result);\n\n# Output:\n# true\n<\/code><\/pre>\n<p>In this case, <code>contains(\"World\")<\/code> checks if &#8216;World&#8217; is present in the string <code>str<\/code>. It returns true, indicating that &#8216;World&#8217; is indeed part of the string.<\/p>\n<h3>Comparing with the <code>equals()<\/code> Method<\/h3>\n<p>The <code>equals()<\/code> method compares two strings for equality. Let&#8217;s try it out:<\/p>\n<pre><code class=\"language-java line-numbers\">String str1 = \"Hello\";\nString str2 = \"Hello\";\nboolean result = str1.equals(str2);\nSystem.out.println(result);\n\n# Output:\n# true\n<\/code><\/pre>\n<p>Here, <code>equals(str2)<\/code> compares <code>str1<\/code> with <code>str2<\/code>. It returns true, as both strings are indeed equal.<\/p>\n<p>These are just a few of the basic Java String methods. Understanding and mastering these methods can significantly simplify your string manipulation tasks in Java. In the next section, we&#8217;ll explore some more advanced methods and their uses.<\/p>\n<h2>Diving Deeper: Advanced Java String Methods<\/h2>\n<p>After mastering the basic Java String methods, it&#8217;s time to take a step further. Let&#8217;s discuss some more complex methods that can help you carry out more advanced string manipulations.<\/p>\n<h3>The <code>compareTo()<\/code> Method<\/h3>\n<p>The <code>compareTo()<\/code> method compares two strings lexicographically, returning an integer based on the comparison. Let&#8217;s see it in action:<\/p>\n<pre><code class=\"language-java line-numbers\">String str1 = \"Apple\";\nString str2 = \"Banana\";\nint result = str1.compareTo(str2);\nSystem.out.println(result);\n\n# Output:\n# -1\n<\/code><\/pre>\n<p>In this case, <code>compareTo(str2)<\/code> compares <code>str1<\/code> with <code>str2<\/code>. It returns -1, indicating that <code>str1<\/code> is lexicographically less than <code>str2<\/code>.<\/p>\n<h3>Locating with <code>indexOf()<\/code> and <code>lastIndexOf()<\/code> Methods<\/h3>\n<p>The <code>indexOf()<\/code> method returns the index of the first occurrence of a specified character or substring, while <code>lastIndexOf()<\/code> returns the index of the last occurrence. Let&#8217;s try them out:<\/p>\n<pre><code class=\"language-java line-numbers\">String str = \"Hello World, Hello Everyone\";\nint firstIndex = str.indexOf(\"Hello\");\nint lastIndex = str.lastIndexOf(\"Hello\");\nSystem.out.println(firstIndex);\nSystem.out.println(lastIndex);\n\n# Output:\n# 0\n# 13\n<\/code><\/pre>\n<p>Here, <code>indexOf(\"Hello\")<\/code> returns the index of the first occurrence of &#8216;Hello&#8217;, which is at the start of the string (index 0). On the other hand, <code>lastIndexOf(\"Hello\")<\/code> returns the index of the last occurrence of &#8216;Hello&#8217;, which is 13.<\/p>\n<h3>Replacing with the <code>replace()<\/code> Method<\/h3>\n<p>The <code>replace()<\/code> method replaces all occurrences of a specified character or substring with another. Here&#8217;s an example:<\/p>\n<pre><code class=\"language-java line-numbers\">String str = \"Hello World\";\nString newStr = str.replace(\"World\", \"Everyone\");\nSystem.out.println(newStr);\n\n# Output:\n# Hello Everyone\n<\/code><\/pre>\n<p>In this case, <code>replace(\"World\", \"Everyone\")<\/code> replaces all occurrences of &#8216;World&#8217; with &#8216;Everyone&#8217; in the string <code>str<\/code>.<\/p>\n<h3>Splitting with the <code>split()<\/code> Method<\/h3>\n<p>The <code>split()<\/code> method splits a string into an array of substrings based on a specified delimiter. Let&#8217;s see how it works:<\/p>\n<pre><code class=\"language-java line-numbers\">String str = \"Hello,World,Hello,Everyone\";\nString[] parts = str.split(\",\");\nfor(String part : parts) {\n    System.out.println(part);\n}\n\n# Output:\n# Hello\n# World\n# Hello\n# Everyone\n<\/code><\/pre>\n<p>Here, <code>split(\",\")<\/code> splits the string <code>str<\/code> into an array of substrings at each comma. The resulting array is then printed to the console.<\/p>\n<p>These advanced Java String methods can provide you with more control and flexibility when working with strings. By understanding these methods, you can write more efficient and cleaner code.<\/p>\n<h2>Exploring Alternatives: StringBuilder and StringBuffer<\/h2>\n<p>While the Java String class provides a wide range of methods for string manipulation, there are alternative approaches to consider, especially when dealing with large amounts of data or complex operations. Let&#8217;s dive into the StringBuilder and StringBuffer classes and see how they can help us manipulate strings more effectively.<\/p>\n<h3>StringBuilder: An Efficient Alternative<\/h3>\n<p>StringBuilder is a mutable sequence of characters. Its mutable nature makes it particularly useful when dealing with large strings or performing numerous modifications on a string.<\/p>\n<p>Here&#8217;s a simple example of using StringBuilder to concatenate strings:<\/p>\n<pre><code class=\"language-java line-numbers\">StringBuilder sb = new StringBuilder();\nsb.append(\"Hello\");\nsb.append(\" \");\nsb.append(\"World\");\nSystem.out.println(sb.toString());\n\n# Output:\n# Hello World\n<\/code><\/pre>\n<p>In this example, we create a StringBuilder object <code>sb<\/code> and append &#8216;Hello&#8217;, a space, and &#8216;World&#8217; to it. The <code>toString()<\/code> method is then used to convert the StringBuilder to a String for output.<\/p>\n<h3>StringBuffer: Thread-Safe String Manipulation<\/h3>\n<p>Similar to StringBuilder, StringBuffer is also a mutable sequence of characters. The key difference is that StringBuffer is thread-safe, meaning it can be used safely in multithreaded environments.<\/p>\n<p>Here&#8217;s an example of using StringBuffer to reverse a string:<\/p>\n<pre><code class=\"language-java line-numbers\">StringBuffer sb = new StringBuffer(\"Hello World\");\nsb.reverse();\nSystem.out.println(sb.toString());\n\n# Output:\n# dlroW olleH\n<\/code><\/pre>\n<p>In this case, we create a StringBuffer object <code>sb<\/code> with &#8216;Hello World&#8217;. We then call the <code>reverse()<\/code> method to reverse the string.<\/p>\n<p>While both StringBuilder and StringBuffer offer similar functionality, they each have their advantages and disadvantages. StringBuilder is typically faster and recommended for single-threaded environments, while StringBuffer, being thread-safe, is suitable for multithreaded environments.<\/p>\n<p>By exploring these alternative approaches, you can choose the most efficient way to manipulate strings in Java based on your specific use-case.<\/p>\n<h2>Troubleshooting Java String Methods<\/h2>\n<p>While working with Java String methods, you may encounter certain issues or exceptions. Let&#8217;s discuss some of the most common ones and how to tackle them.<\/p>\n<h3>Dealing with <code>NullPointerException<\/code><\/h3>\n<p>A <code>NullPointerException<\/code> occurs when you try to invoke a method or property on a null object. Here&#8217;s an example:<\/p>\n<pre><code class=\"language-java line-numbers\">String str = null;\nint len = str.length();\n\n# Output:\n# Exception in thread \"main\" java.lang.NullPointerException\n<\/code><\/pre>\n<p>In this case, we&#8217;re trying to invoke the <code>length()<\/code> method on a null string, which throws a <code>NullPointerException<\/code>. To avoid this, always check if a string is null before invoking any methods on it.<\/p>\n<h3>Handling <code>StringIndexOutOfBoundsException<\/code><\/h3>\n<p>A <code>StringIndexOutOfBoundsException<\/code> is thrown when attempting to access an index beyond the length of the string or a negative index. Let&#8217;s see an example:<\/p>\n<pre><code class=\"language-java line-numbers\">String str = \"Hello\";\nchar ch = str.charAt(10);\n\n# Output:\n# Exception in thread \"main\" java.lang.StringIndexOutOfBoundsException: String index out of range: 10\n<\/code><\/pre>\n<p>Here, we&#8217;re trying to access the character at index 10 of the string &#8216;Hello&#8217;, which only has 5 characters. This throws a <code>StringIndexOutOfBoundsException<\/code>. To avoid this, ensure that the index you&#8217;re trying to access is within the length of the string.<\/p>\n<h3>Other Considerations<\/h3>\n<p>When working with string methods, also consider the following:<\/p>\n<ul>\n<li>Remember that strings are immutable in Java. Any operation that modifies a string will actually create a new string.<\/li>\n<li>Be mindful of the <code>equals()<\/code> and <code>==<\/code> operator. The <code>equals()<\/code> method checks for value equality, while the <code>==<\/code> operator checks for reference equality.<\/li>\n<\/ul>\n<p>By being aware of these common issues and considerations, you can avoid many common pitfalls when working with Java String methods.<\/p>\n<h2>Unraveling the Java String Class<\/h2>\n<p>Before we delve deeper into Java String methods, it&#8217;s crucial to understand the fundamentals of the Java String class and the concept of string immutability.<\/p>\n<h3>The Java String Class<\/h3>\n<p>In Java, strings are represented as objects of the String class. The String class provides numerous methods to perform operations on strings such as comparing strings, searching characters or substrings, changing case, concatenating strings, and more.<\/p>\n<p>Here&#8217;s a simple example of creating a string in Java:<\/p>\n<pre><code class=\"language-java line-numbers\">String str = \"Hello World\";\nSystem.out.println(str);\n\n# Output:\n# Hello World\n<\/code><\/pre>\n<p>In this example, we create a string <code>str<\/code> with the value &#8216;Hello World&#8217; and then print it to the console.<\/p>\n<h3>Immutability of Strings in Java<\/h3>\n<p>One of the key characteristics of the Java String class is that strings are immutable. This means that once a string is created, it cannot be changed. Any operation that seems to modify a string actually creates a new string.<\/p>\n<p>Let&#8217;s see this in action:<\/p>\n<pre><code class=\"language-java line-numbers\">String str1 = \"Hello\";\nString str2 = str1;\nstr1 = str1 + \" World\";\n\nSystem.out.println(str1);\nSystem.out.println(str2);\n\n# Output:\n# Hello World\n# Hello\n<\/code><\/pre>\n<p>In this example, we first create a string <code>str1<\/code> with the value &#8216;Hello&#8217; and assign it to <code>str2<\/code>. We then append &#8216; World&#8217; to <code>str1<\/code>. However, this operation does not modify the original &#8216;Hello&#8217; string. Instead, it creates a new string &#8216;Hello World&#8217; and assigns it to <code>str1<\/code>. The <code>str2<\/code> still points to the original &#8216;Hello&#8217; string, demonstrating the immutability of strings in Java.<\/p>\n<h3>The Impact of Immutability on String Methods<\/h3>\n<p>The immutability of strings affects how string methods work in Java. Since strings cannot be changed, any string method that modifies a string will actually create a new string. This is important to remember when working with string methods as it can impact performance, especially when dealing with large amounts of data or performing numerous string operations.<\/p>\n<p>Understanding these fundamentals of the Java String class and the concept of string immutability is crucial to effectively using and interpreting the results of Java String methods.<\/p>\n<h2>Java String Methods: The Bigger Picture<\/h2>\n<p>Java String methods are not just useful for basic string manipulations. Their relevance extends to larger projects and more complex tasks. Let&#8217;s explore how these methods play a role in broader contexts and related concepts you might want to explore.<\/p>\n<h3>String Methods in Data Parsing<\/h3>\n<p>Java String methods are often used in data parsing tasks. For instance, the <code>split()<\/code> method can be used to parse CSV files, and the <code>trim()<\/code> method can help clean up data by removing extra spaces.<\/p>\n<pre><code class=\"language-java line-numbers\">String line = \"John,Doe,25\";\nString[] data = line.split(\",\");\nfor(String datum : data) {\n    System.out.println(datum.trim());\n}\n\n# Output:\n# John\n# Doe\n# 25\n<\/code><\/pre>\n<p>In this example, we use the <code>split()<\/code> method to parse a line of CSV data into an array. We then use the <code>trim()<\/code> method to remove any extra spaces around the data.<\/p>\n<h3>String Methods in File Handling<\/h3>\n<p>When working with files, Java String methods like <code>replace()<\/code>, <code>substring()<\/code>, and <code>contains()<\/code> can be used to manipulate file paths, extract file extensions, or check if a path contains a specific directory.<\/p>\n<h3>Exploring Related Concepts<\/h3>\n<p>Beyond Java String methods, there are several related concepts that can further enhance your string manipulation skills. Regular expressions in Java, for instance, allow you to perform complex pattern matching and string manipulations. String formatting can help you create neatly formatted strings for output.<\/p>\n<h3>Further Resources for Mastering Java String Methods<\/h3>\n<p>To deepen your understanding of Java String methods and related concepts, consider exploring the following resources:<\/p>\n<ul>\n<li><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/java-string\/\">Advanced Techniques for Using Strings in Java<\/a> &#8211; Learn about the Java String class&#8217;s methods for substring comparison.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/java-matcher\/\">Using Matchers in Java<\/a> &#8211; Master using Matcher for advanced pattern matching and text manipulation tasks in Java.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/ioflood.com\/blog\/length-of-string-java\/\">String Length in Java<\/a> &#8211; Understand how to determine the length of a string in Java using built-in methods.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/docs.oracle.com\/javase\/7\/docs\/api\/java\/lang\/String.html\" target=\"_blank\" rel=\"noopener\">Java String Documentation<\/a> &#8211; The official Java documentation on all String methods.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/www.vogella.com\/tutorials\/JavaRegularExpressions\/article.html\" target=\"_blank\" rel=\"noopener\">Java Regular Expressions Tutorial<\/a> &#8211; A guide to using regular expressions in Java.<\/p>\n<\/li>\n<li>\n<p><a class=\"wp-editor-md-post-content-link\" href=\"https:\/\/dzone.com\/articles\/java-string-format-examples\" target=\"_blank\" rel=\"noopener\">Java String Formatting Guide<\/a> provides various examples of string formatting in Java.<\/p>\n<\/li>\n<\/ul>\n<p>By understanding the broader applications of Java String methods and exploring related concepts, you can take your Java skills to the next level.<\/p>\n<h2>Wrapping Up: Mastering Java String Methods<\/h2>\n<p>In this comprehensive guide, we&#8217;ve explored the fascinating world of Java String methods. These methods offer a robust toolkit for string manipulation, making it easier to perform everyday tasks and complex operations alike.<\/p>\n<p>We began with the basics, understanding how to use fundamental Java String methods like <code>length()<\/code>, <code>charAt()<\/code>, <code>substring()<\/code>, <code>contains()<\/code>, and <code>equals()<\/code>. Each of these methods plays a crucial role in string manipulation, providing the building blocks for more advanced operations.<\/p>\n<p>We then ventured into more advanced territory, diving deeper into the Java String class. We explored methods like <code>compareTo()<\/code>, <code>indexOf()<\/code>, <code>lastIndexOf()<\/code>, <code>replace()<\/code>, and <code>split()<\/code>, each offering more complex functionality for string manipulation. We also discussed alternative approaches, such as using the StringBuilder and StringBuffer classes for more efficient string handling.<\/p>\n<p>Along the way, we tackled common issues that you might encounter when using Java String methods, such as <code>NullPointerException<\/code> and <code>StringIndexOutOfBoundsException<\/code>, providing solutions and workarounds for each issue.<\/p>\n<p>Here&#8217;s a quick comparison of the methods we&#8217;ve discussed:<\/p>\n<table>\n<thead>\n<tr>\n<th>Method<\/th>\n<th>Use Case<\/th>\n<th>Pitfalls<\/th>\n<\/tr>\n<\/thead>\n<tbody>\n<tr>\n<td>Basic String Methods (<code>length()<\/code>, <code>charAt()<\/code>, etc.)<\/td>\n<td>Basic string operations<\/td>\n<td>None<\/td>\n<\/tr>\n<tr>\n<td>Advanced String Methods (<code>compareTo()<\/code>, <code>indexOf()<\/code>, etc.)<\/td>\n<td>More complex string operations<\/td>\n<td>May throw exceptions if used incorrectly<\/td>\n<\/tr>\n<tr>\n<td>StringBuilder and StringBuffer<\/td>\n<td>Efficient string manipulation in large-scale or multithreaded applications<\/td>\n<td>None<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>Whether you&#8217;re just starting out with Java or looking to level up your string manipulation skills, we hope this guide has given you a deeper understanding of Java String methods and their capabilities.<\/p>\n<p>With its balance of simplicity, flexibility, and power, Java&#8217;s String class is an indispensable tool for any programmer. Now, you&#8217;re well equipped to make the most of it. Happy coding!<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Are you finding it challenging to work with Java String methods? You&#8217;re not alone. Many developers, both beginners and experienced, often struggle with string manipulation in Java. But, think of the Java String class as a Swiss Army knife, offering a plethora of methods to manipulate strings effectively. This guide will walk you through the [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":10026,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[154,121],"tags":[],"class_list":["post-5502","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-java","category-programming-coding","cat-154-id","cat-121-id","has_thumb"],"_links":{"self":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5502","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/comments?post=5502"}],"version-history":[{"count":8,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5502\/revisions"}],"predecessor-version":[{"id":17651,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/posts\/5502\/revisions\/17651"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media\/10026"}],"wp:attachment":[{"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/media?parent=5502"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/categories?post=5502"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/ioflood.com\/blog\/wp-json\/wp\/v2\/tags?post=5502"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}