<?xml version="1.0" encoding="utf-8" standalone="yes"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:content="http://purl.org/rss/1.0/modules/content/">
  <channel>
    <title>ReplacingOccurrences on Sobamemil</title>
    <link>https://blog.sobamemil.com/en/tags/replacingoccurrences/</link>
    <description>Recent content in ReplacingOccurrences on Sobamemil</description>
    <image>
      <title>Sobamemil</title>
      <url>https://blog.sobamemil.com/images/og-image.png</url>
      <link>https://blog.sobamemil.com/images/og-image.png</link>
    </image>
    <generator>Hugo</generator>
    <language>en</language>
    <lastBuildDate>Tue, 20 Jun 2023 20:51:27 +0900</lastBuildDate>
    <atom:link href="https://blog.sobamemil.com/en/tags/replacingoccurrences/index.xml" rel="self" type="application/rss+xml" />
    <item>
      <title>[Swift] Concatenating and Printing Strings - Programmers Lv.0 (181946)</title>
      <link>https://blog.sobamemil.com/en/posts/192-swift-%EB%AC%B8%EC%9E%90%EC%97%B4-%EB%B6%99%EC%97%AC%EC%84%9C-%EC%B6%9C%EB%A0%A5%ED%95%98%EA%B8%B0-lv0-181946-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4/</link>
      <pubDate>Tue, 20 Jun 2023 20:51:27 +0900</pubDate>
      <guid>https://blog.sobamemil.com/en/posts/192-swift-%EB%AC%B8%EC%9E%90%EC%97%B4-%EB%B6%99%EC%97%AC%EC%84%9C-%EC%B6%9C%EB%A0%A5%ED%95%98%EA%B8%B0-lv0-181946-%ED%94%84%EB%A1%9C%EA%B7%B8%EB%9E%98%EB%A8%B8%EC%8A%A4/</guid>
      <description>&lt;p&gt;&lt;b&gt;Problem:&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;두 개의 문자열 str1, str2가 공백으로 구분되어 입력으로 주어집니다.&lt;br&gt;
입출력 예와 같이 str1과 str2을 이어서 출력하는 코드를 작성해 보세요.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;&lt;a href=&#34;https://school.programmers.co.kr/learn/courses/30/lessons/181946&#34;&gt;https://school.programmers.co.kr/learn/courses/30/lessons/181946&lt;/a&gt;&lt;/b&gt;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;Constraints:&lt;/b&gt;&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;1 ≤ str1, str2의 길이 ≤ 10&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;b&gt;Solution:&lt;/b&gt;&lt;/p&gt;
&lt;div class=&#34;highlight&#34;&gt;&lt;pre tabindex=&#34;0&#34; style=&#34;color:#f8f8f2;background-color:#272822;-moz-tab-size:4;-o-tab-size:4;tab-size:4;&#34;&gt;&lt;code class=&#34;language-cpp&#34; data-lang=&#34;cpp&#34;&gt;&lt;span style=&#34;display:flex;&#34;&gt;&lt;span&gt;print(readLine()&lt;span style=&#34;color:#f92672&#34;&gt;!&lt;/span&gt;.components(separatedBy: [&lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; &amp;#34;&lt;/span&gt;]).joined().replacingOccurrences(of: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34; &amp;#34;&lt;/span&gt;, with: &lt;span style=&#34;color:#e6db74&#34;&gt;&amp;#34;&amp;#34;&lt;/span&gt;))
&lt;/span&gt;&lt;/span&gt;&lt;/code&gt;&lt;/pre&gt;&lt;/div&gt;&lt;p&gt;두 문자열 사이의 공백을 제거하고 출력하면 되는 문제입니다. 방법은 아주 많겠지만 한 줄로 해결해 보았습니다.&lt;/p&gt;
&lt;p&gt;swift에서는 replacingOccurrences(of:with:)를 사용해서 of 위치의 문자열을 with 문자열로 쉽게 변경할 수 있습니다.&lt;/p&gt;
&lt;p&gt;](&lt;/p&gt;</description>
    </item>
  </channel>
</rss>
