<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://nsis.sourceforge.io/mediawiki/index.php?action=history&amp;feed=atom&amp;title=StrTrimNewLines</id>
	<title>StrTrimNewLines - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://nsis.sourceforge.io/mediawiki/index.php?action=history&amp;feed=atom&amp;title=StrTrimNewLines"/>
	<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=StrTrimNewLines&amp;action=history"/>
	<updated>2026-05-12T21:41:33Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.39.17</generator>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=StrTrimNewLines&amp;diff=25126&amp;oldid=prev</id>
		<title>Anders: Call function directly</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=StrTrimNewLines&amp;diff=25126&amp;oldid=prev"/>
		<updated>2018-07-04T13:35:24Z</updated>

		<summary type="html">&lt;p&gt;Call function directly&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;â† Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 13:35, 4 July 2018&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l17&quot;&gt;Line 17:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 17:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;highlight-nsis&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;highlight-nsis&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Push &amp;quot;String&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Push &amp;quot;String&amp;quot;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;!insertmacro &lt;/del&gt;StrTrimNewLines &lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Func &amp;quot;&amp;quot;&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;Call &lt;/ins&gt;StrTrimNewLines&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Pop $ResultVar&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;Pop $ResultVar&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/highlight-nsis&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;lt;/highlight-nsis&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key n22049_wiki-wiki_:diff::1.12:old-25125:rev-25126 --&gt;
&lt;/table&gt;</summary>
		<author><name>Anders</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=StrTrimNewLines&amp;diff=25125&amp;oldid=prev</id>
		<title>Anders: Rewritten version that works in uninstallers</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=StrTrimNewLines&amp;diff=25125&amp;oldid=prev"/>
		<updated>2018-07-04T13:32:47Z</updated>

		<summary type="html">&lt;p&gt;Rewritten version that works in uninstallers&lt;/p&gt;
&lt;a href=&quot;https://nsis.sourceforge.io/mediawiki/index.php?title=StrTrimNewLines&amp;amp;diff=25125&amp;amp;oldid=8635&quot;&gt;Show changes&lt;/a&gt;</summary>
		<author><name>Anders</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=StrTrimNewLines&amp;diff=8635&amp;oldid=prev</id>
		<title>Deguix: Corrected link to LogicLib header file.</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=StrTrimNewLines&amp;diff=8635&amp;oldid=prev"/>
		<updated>2005-12-03T06:19:15Z</updated>

		<summary type="html">&lt;p&gt;Corrected link to &lt;a href=&quot;/LogicLib_header_file&quot; title=&quot;LogicLib header file&quot;&gt;LogicLib header file&lt;/a&gt;.&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;â† Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;Revision as of 06:19, 3 December 2005&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l3&quot;&gt;Line 3:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 3:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Description ==&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;== Description ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Requires:&amp;#039;&amp;#039;&amp;#039; [[LogicLib]].&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Requires:&amp;#039;&amp;#039;&amp;#039; [[LogicLib &lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;header file&lt;/ins&gt;]].&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br/&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Version:&amp;#039;&amp;#039;&amp;#039; 2.0.1.&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&amp;#039;&amp;#039;&amp;#039;Version:&amp;#039;&amp;#039;&amp;#039; 2.0.1.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key n22049_wiki-wiki_:diff::1.12:old-6737:rev-8635 --&gt;
&lt;/table&gt;</summary>
		<author><name>Deguix</name></author>
	</entry>
	<entry>
		<id>https://nsis.sourceforge.io/mediawiki/index.php?title=StrTrimNewLines&amp;diff=6737&amp;oldid=prev</id>
		<title>Deguix: Version: 2.0.</title>
		<link rel="alternate" type="text/html" href="https://nsis.sourceforge.io/mediawiki/index.php?title=StrTrimNewLines&amp;diff=6737&amp;oldid=prev"/>
		<updated>2005-07-10T07:27:52Z</updated>

		<summary type="html">&lt;p&gt;Version: 2.0.&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{{PageAuthor|deguix}}&lt;br /&gt;
&lt;br /&gt;
== Description ==&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Requires:&amp;#039;&amp;#039;&amp;#039; [[LogicLib]].&lt;br /&gt;
&lt;br /&gt;
&amp;#039;&amp;#039;&amp;#039;Version:&amp;#039;&amp;#039;&amp;#039; 2.0.1.&lt;br /&gt;
&lt;br /&gt;
This function removes unnecessary new lines at end of a string.&lt;br /&gt;
&lt;br /&gt;
== How To Use ==&lt;br /&gt;
&lt;br /&gt;
=== Syntax ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
${StrTrimNewLines} &amp;quot;ResultVar&amp;quot; &amp;quot;String&amp;quot;&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
or&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
Push &amp;quot;String&amp;quot;&lt;br /&gt;
Call StrTrimNewLines&lt;br /&gt;
Pop &amp;quot;ResultVar&amp;quot;&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
=== Parameters ===&lt;br /&gt;
&lt;br /&gt;
; ResultVar&lt;br /&gt;
: Variable where the string without the new line characters at the end is returned. If there is no new line characters, the return value is the same as specified in &amp;#039;&amp;#039;String&amp;#039;&amp;#039; parameter.&lt;br /&gt;
&lt;br /&gt;
; String&lt;br /&gt;
: String where the new line characters at its end are removed.&lt;br /&gt;
&lt;br /&gt;
=== Example ===&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
${StrTrimNewLines} $0 &amp;quot;This is just an example$\r$\n$\r$\n&amp;quot;&lt;br /&gt;
;$0 = &amp;quot;This is just an example&amp;quot;&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Function Code ==&lt;br /&gt;
&lt;br /&gt;
&amp;lt;highlight-nsis&amp;gt;&lt;br /&gt;
!define StrTrimNewLines &amp;quot;!insertmacro StrTrimNewLines&amp;quot;&lt;br /&gt;
&lt;br /&gt;
!macro StrTrimNewLines ResultVar String&lt;br /&gt;
  Push &amp;quot;${String}&amp;quot;&lt;br /&gt;
  Call StrTrimNewLines&lt;br /&gt;
  Pop &amp;quot;${ResultVar}&amp;quot;&lt;br /&gt;
!macroend&lt;br /&gt;
&lt;br /&gt;
Function StrTrimNewLines&lt;br /&gt;
/*After this point:&lt;br /&gt;
  ------------------------------------------&lt;br /&gt;
  $R0 = String (input)&lt;br /&gt;
  $R1 = TrimCounter (temp)&lt;br /&gt;
  $R2 = Temp (temp)*/&lt;br /&gt;
&lt;br /&gt;
  ;Get input from user&lt;br /&gt;
  Exch $R0&lt;br /&gt;
  Push $R1&lt;br /&gt;
  Push $R2&lt;br /&gt;
      &lt;br /&gt;
  ;Initialize trim counter&lt;br /&gt;
  StrCpy $R1 0&lt;br /&gt;
&lt;br /&gt;
  loop:&lt;br /&gt;
  ;Subtract to get &amp;quot;String&amp;quot;&amp;#039;s last characters&lt;br /&gt;
  IntOp $R1 $R1 - 1&lt;br /&gt;
&lt;br /&gt;
  ;Verify if they are either $\r or $\n&lt;br /&gt;
  StrCpy $R2 $R0 1 $R1&lt;br /&gt;
  ${If} $R2 == `$\r`&lt;br /&gt;
  ${OrIf} $R2 == `$\n`&lt;br /&gt;
    Goto loop&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
  ;Trim characters (if needed)&lt;br /&gt;
  IntOp $R1 $R1 + 1&lt;br /&gt;
  ${If} $R1 &amp;lt; 0&lt;br /&gt;
    StrCpy $R0 $R0 $R1&lt;br /&gt;
  ${EndIf}&lt;br /&gt;
&lt;br /&gt;
/*After this point:&lt;br /&gt;
  ------------------------------------------&lt;br /&gt;
  $R0 = ResultVar (output)*/&lt;br /&gt;
&lt;br /&gt;
  ;Return output to user&lt;br /&gt;
  Pop $R2&lt;br /&gt;
  Pop $R1&lt;br /&gt;
  Exch $R0&lt;br /&gt;
FunctionEnd&lt;br /&gt;
&amp;lt;/highlight-nsis&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Credits ==&lt;br /&gt;
Version 2.x - Diego Pedroso ([[User:deguix|deguix]]).&amp;lt;br&amp;gt;&lt;br /&gt;
Version 1.x - Ximon Eighteen ([[User:sunjammer|sunjammer]]) / Diego Pedroso ([[User:deguix|deguix]]).&lt;br /&gt;
&lt;br /&gt;
[[Category:String Functions]]&lt;/div&gt;</summary>
		<author><name>Deguix</name></author>
	</entry>
</feed>