<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
	<id>https://wiki.harlamenkov.ru/index.php?action=history&amp;feed=atom&amp;title=EN%2Fdocumentation%2Fbasic_guide%2Fstrings_runtime_library</id>
	<title>EN/documentation/basic guide/strings runtime library - Revision history</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.harlamenkov.ru/index.php?action=history&amp;feed=atom&amp;title=EN%2Fdocumentation%2Fbasic_guide%2Fstrings_runtime_library"/>
	<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/strings_runtime_library&amp;action=history"/>
	<updated>2026-11-11T13:49:34Z</updated>
	<subtitle>Revision history for this page on the wiki</subtitle>
	<generator>MediaWiki 1.33.0</generator>
	<entry>
		<id>https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/strings_runtime_library&amp;diff=16855&amp;oldid=prev</id>
		<title>Sancho at 10:48, 6 September 2011</title>
		<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/strings_runtime_library&amp;diff=16855&amp;oldid=prev"/>
		<updated>2011-09-06T10:48:06Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 10:48, 6 September 2011&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-l123&quot; &gt;Line 123:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 123:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/source&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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 class=&quot;diffchange diffchange-inline&quot;&gt;Documentation/&lt;/del&gt;Caution|When it is used with 4 arguments, to replace a sub-string in a string, &amp;lt;tt&amp;gt;Mid&amp;lt;/tt&amp;gt; is an '''instruction''', not a function : it does not return any value !}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;{{Caution|When it is used with 4 arguments, to replace a sub-string in a string, &amp;lt;tt&amp;gt;Mid&amp;lt;/tt&amp;gt; is an '''instruction''', not a function : it does not return any value !}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;== Formatting Strings ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;== Formatting Strings ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sancho</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/strings_runtime_library&amp;diff=15936&amp;oldid=prev</id>
		<title>Sancho at 16:50, 2 September 2011</title>
		<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/strings_runtime_library&amp;diff=15936&amp;oldid=prev"/>
		<updated>2011-09-02T16:50:11Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&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: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 16:50, 2 September 2011&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-l4&quot; &gt;Line 4:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 4:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;|ShowPrevNext=block&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;|ShowPrevNext=block&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;|ShowPrevPage=block&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;|ShowPrevPage=block&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;|PrevPage=EN/documentation/basic_guide/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;conversion_functions_(runtime_library)&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;|PrevPage=EN/documentation/basic_guide/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;conversion_functions_runtime_library&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;−&lt;/td&gt;&lt;td style=&quot;color: #222; 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;|NextPage=EN/documentation/basic_guide/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;date_and_time_(runtime_library)&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;color: #222; 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;|NextPage=EN/documentation/basic_guide/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;date_and_time_runtime_library&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;|runtime=block&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;|runtime=block&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;}}&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #222; 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;}}&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Sancho</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/strings_runtime_library&amp;diff=15932&amp;oldid=prev</id>
		<title>Sancho: moved EN/documentation/basic guide/strings (runtime library) to EN/documentation/basic guide/strings runtime library</title>
		<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/strings_runtime_library&amp;diff=15932&amp;oldid=prev"/>
		<updated>2011-09-02T16:43:13Z</updated>

		<summary type="html">&lt;p&gt;moved &lt;a href=&quot;/index.php?title=EN/documentation/basic_guide/strings_(runtime_library)&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;EN/documentation/basic guide/strings (runtime library) (page does not exist)&quot;&gt;EN/documentation/basic guide/strings (runtime library)&lt;/a&gt; to &lt;a href=&quot;/wiki/EN/documentation/basic_guide/strings_runtime_library&quot; title=&quot;EN/documentation/basic guide/strings runtime library&quot;&gt;EN/documentation/basic guide/strings runtime library&lt;/a&gt;&lt;/p&gt;
&lt;table class=&quot;diff diff-contentalign-left&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;en&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;← Older revision&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #222; text-align: center;&quot;&gt;Revision as of 16:43, 2 September 2011&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;en&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;(No difference)&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Sancho</name></author>
		
	</entry>
	<entry>
		<id>https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/strings_runtime_library&amp;diff=15894&amp;oldid=prev</id>
		<title>Sancho: Created page with &quot;&lt;section begin=title /&gt;&lt;noinclude&gt;{{DISPLAYTITLE:&lt;/noinclude&gt;Strings ({{OOo}} BASIC Runtime Library)&lt;noinclude&gt;}}&lt;/noinclude&gt;&lt;section end=title /&gt;{{BreadCrumbL10n}}  {{Documentat...&quot;</title>
		<link rel="alternate" type="text/html" href="https://wiki.harlamenkov.ru/index.php?title=EN/documentation/basic_guide/strings_runtime_library&amp;diff=15894&amp;oldid=prev"/>
		<updated>2011-09-01T16:09:06Z</updated>

		<summary type="html">&lt;p&gt;Created page with &amp;quot;&amp;lt;section begin=title /&amp;gt;&amp;lt;noinclude&amp;gt;{{DISPLAYTITLE:&amp;lt;/noinclude&amp;gt;Strings ({{OOo}} BASIC Runtime Library)&amp;lt;noinclude&amp;gt;}}&amp;lt;/noinclude&amp;gt;&amp;lt;section end=title /&amp;gt;{{BreadCrumbL10n}}  {{Documentat...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;&amp;lt;section begin=title /&amp;gt;&amp;lt;noinclude&amp;gt;{{DISPLAYTITLE:&amp;lt;/noinclude&amp;gt;Strings ({{OOo}} BASIC Runtime Library)&amp;lt;noinclude&amp;gt;}}&amp;lt;/noinclude&amp;gt;&amp;lt;section end=title /&amp;gt;{{BreadCrumbL10n}}&lt;br /&gt;
&lt;br /&gt;
{{Documentation/BASICGuideTOC&lt;br /&gt;
|ShowPrevNext=block&lt;br /&gt;
|ShowPrevPage=block&lt;br /&gt;
|PrevPage=EN/documentation/basic_guide/conversion_functions_(runtime_library)&lt;br /&gt;
|NextPage=EN/documentation/basic_guide/date_and_time_(runtime_library)&lt;br /&gt;
|runtime=block&lt;br /&gt;
}}&lt;br /&gt;
&lt;br /&gt;
__NOTOC__ &lt;br /&gt;
&lt;br /&gt;
== Working with Sets of Characters ==&lt;br /&gt;
&lt;br /&gt;
When administering strings, {{OOo}} Basic uses the set of Unicode characters. The &amp;lt;tt&amp;gt;Asc&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;Chr&amp;lt;/tt&amp;gt; functions allow the Unicode value belonging to a character to be established and/or the corresponding character to be found for a Unicode value. The following expressions assign the various Unicode values to the code variable:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Code = Asc(&amp;quot;A&amp;quot;)         ' Latin letter A (Unicode-value 65)&lt;br /&gt;
Code = Asc(&amp;quot;€&amp;quot;)         ' Euro character (Unicode-value 8364)&lt;br /&gt;
Code = Asc(&amp;quot;Л&amp;quot;)         ' Cyrillic letter Л (Unicode-value 1083)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Conversely, the expression &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
MyString = Chr(13)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
ensures that the &amp;lt;tt&amp;gt;MyString&amp;lt;/tt&amp;gt; string is initialized with the value of the number &amp;lt;tt&amp;gt;13&amp;lt;/tt&amp;gt;, which stands for a hard line break.&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Chr&amp;lt;/tt&amp;gt; command is often used in Basic languages to insert control characters in a string. The assignment&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
MyString = Chr(9) + &amp;quot;This is a test&amp;quot; + Chr(13)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
therefore ensures that the text is preceded by a tab character (Unicode-value 9) and that a hard line break (Unicode-value 13) is added after the text. &lt;br /&gt;
&lt;br /&gt;
== Accessing Parts of a String ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic provides three functions that return partial strings, plus a length function: &lt;br /&gt;
&lt;br /&gt;
;&amp;lt;tt&amp;gt;Left(MyString, Length)&amp;lt;/tt&amp;gt;:returns the first &amp;lt;tt&amp;gt;Length&amp;lt;/tt&amp;gt; characters of &amp;lt;tt&amp;gt;MyString&amp;lt;/tt&amp;gt;.&lt;br /&gt;
;&amp;lt;tt&amp;gt;Right(MyString, Length)&amp;lt;/tt&amp;gt;:returns the last &amp;lt;tt&amp;gt;Length&amp;lt;/tt&amp;gt; characters of &amp;lt;tt&amp;gt;MyString&amp;lt;/tt&amp;gt;.&lt;br /&gt;
;&amp;lt;tt&amp;gt;Mid(MyString, Start, Length)&amp;lt;/tt&amp;gt;:returns first &amp;lt;tt&amp;gt;Length&amp;lt;/tt&amp;gt; characters of &amp;lt;tt&amp;gt;MyString&amp;lt;/tt&amp;gt; as of the &amp;lt;tt&amp;gt;Start&amp;lt;/tt&amp;gt; position.&lt;br /&gt;
;&amp;lt;tt&amp;gt;Len(MyString)&amp;lt;/tt&amp;gt;:returns the number of characters in &amp;lt;tt&amp;gt;MyString&amp;lt;/tt&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
Here are a few example calls for the named functions: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim MyString As String&lt;br /&gt;
Dim MyResult As String&lt;br /&gt;
Dim MyLen As Integer&lt;br /&gt;
&lt;br /&gt;
MyString = &amp;quot;This is a small test&amp;quot;&lt;br /&gt;
MyResult = Left(MyString,5)      ' Provides the string &amp;quot;This &amp;quot;&lt;br /&gt;
MyResult = Right(MyString, 5)    ' Provides the string &amp;quot; test&amp;quot;&lt;br /&gt;
MyResult = Mid(MyString, 8, 5)   ' Provides the string &amp;quot; a sm&amp;quot;&lt;br /&gt;
MyLen = Len(MyString)            ' Provides the value 20&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
== Search and Replace ==&lt;br /&gt;
&lt;br /&gt;
{{OOo}} Basic provides the &amp;lt;tt&amp;gt;InStr&amp;lt;/tt&amp;gt; function for searching for a partial string within another string:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
ResultString = InStr (MyString, SearchString)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;SearchString&amp;lt;/tt&amp;gt; parameter specifies the string to be searched for within &amp;lt;tt&amp;gt;MyString&amp;lt;/tt&amp;gt;. The function returns a number that contains the position at which the &amp;lt;tt&amp;gt;SearchString&amp;lt;/tt&amp;gt; first appears within &amp;lt;tt&amp;gt;MyString&amp;lt;/tt&amp;gt;; a return value of zero indicates no match. If you want to find other matches for the string, the function also provides the opportunity to specify an optional start position from which {{OOo}} Basic begins the search. In this case, the syntax of the function is:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
ResultString = InStr(StartPosition, MyString, SearchString)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the previous examples, &amp;lt;tt&amp;gt;InStr&amp;lt;/tt&amp;gt; ignores uppercase and lowercase characters. To change the search so that &amp;lt;tt&amp;gt;InStr&amp;lt;/tt&amp;gt; is case sensitive, add the parameter &amp;lt;tt&amp;gt;0&amp;lt;/tt&amp;gt;, as shown in the following example:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
ResultString = InStr(MyString, SearchString, 0)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Using the previous functions for editing strings, programmers can search for and replace one string in another string: &lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Function Replace(Source As String, Search As String, NewPart As String)&lt;br /&gt;
  Dim Result As String&lt;br /&gt;
  Dim StartPos As Long&lt;br /&gt;
  Dim CurrentPos As Long&lt;br /&gt;
&lt;br /&gt;
  Result = &amp;quot;&amp;quot;&lt;br /&gt;
  StartPos = 1&lt;br /&gt;
  CurrentPos = 1&lt;br /&gt;
&lt;br /&gt;
  If Search = &amp;quot;&amp;quot; Then&lt;br /&gt;
    Result = Source&lt;br /&gt;
  Else &lt;br /&gt;
    Do While CurrentPos &amp;lt;&amp;gt; 0&lt;br /&gt;
      CurrentPos = InStr(StartPos, Source, Search)&lt;br /&gt;
      If CurrentPos &amp;lt;&amp;gt; 0 Then&lt;br /&gt;
        Result = Result + Mid(Source, StartPos, _&lt;br /&gt;
        CurrentPos - StartPos)&lt;br /&gt;
        Result = Result + NewPart&lt;br /&gt;
        StartPos = CurrentPos + Len(Search)&lt;br /&gt;
      Else&lt;br /&gt;
        Result = Result + Mid(Source, StartPos, Len(Source))&lt;br /&gt;
      End If                ' Position &amp;lt;&amp;gt; 0&lt;br /&gt;
    Loop &lt;br /&gt;
  End If &lt;br /&gt;
&lt;br /&gt;
  Replace = Result&lt;br /&gt;
End Function&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The function searches through the transferred &amp;lt;tt&amp;gt;Search&amp;lt;/tt&amp;gt; string in a loop by means of &amp;lt;tt&amp;gt;InStr&amp;lt;/tt&amp;gt; in the original term &amp;lt;tt&amp;gt;Source&amp;lt;/tt&amp;gt;. If it finds the search term, it takes the part before the expression and writes it to the &amp;lt;tt&amp;gt;Result&amp;lt;/tt&amp;gt; return buffer. It adds the &amp;lt;tt&amp;gt;NewPart&amp;lt;/tt&amp;gt; section at the point of the search term &amp;lt;tt&amp;gt;Search&amp;lt;/tt&amp;gt;. If no more matches are found for the search term, the function establishes the part of the string still remaining and adds this to the return buffer. It returns the string produced in this way as the result of the replacement process.&lt;br /&gt;
&lt;br /&gt;
Since replacing parts of character sequences is one of the most frequently used functions, the &amp;lt;tt&amp;gt;Mid&amp;lt;/tt&amp;gt; function in {{OOo}} Basic has been extended so that this task is performed automatically. The following example replaces three characters with the string &amp;lt;tt&amp;gt;is&amp;lt;/tt&amp;gt; from the sixth position of the &amp;lt;tt&amp;gt;MyString&amp;lt;/tt&amp;gt; string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
Dim MyString As String&lt;br /&gt;
 &lt;br /&gt;
MyString = &amp;quot;This was my text&amp;quot;&lt;br /&gt;
Mid(MyString, 6, 3, &amp;quot;is&amp;quot;)&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
{{Documentation/Caution|When it is used with 4 arguments, to replace a sub-string in a string, &amp;lt;tt&amp;gt;Mid&amp;lt;/tt&amp;gt; is an '''instruction''', not a function : it does not return any value !}}&lt;br /&gt;
&lt;br /&gt;
== Formatting Strings ==&lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;Format&amp;lt;/tt&amp;gt; function formats numbers as a string. To do this, the function expects a &amp;lt;tt&amp;gt;Format&amp;lt;/tt&amp;gt; expression to be specified, which is then used as the template for formatting the numbers. Each place holder within the template ensures that this item is formatted correspondingly in the output value. The five most important place holders within a template are the zero (&amp;lt;tt&amp;gt;0&amp;lt;/tt&amp;gt;), pound sign (&amp;lt;tt&amp;gt;#&amp;lt;/tt&amp;gt;), period (&amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt;), comma (&amp;lt;tt&amp;gt;,&amp;lt;/tt&amp;gt;) and dollar sign (&amp;lt;tt&amp;gt;$&amp;lt;/tt&amp;gt;) characters. &lt;br /&gt;
&lt;br /&gt;
The &amp;lt;tt&amp;gt;0&amp;lt;/tt&amp;gt; character within the template ensures that a number is always placed at the corresponding point. If a number is not provided, 0 is displayed in its place. &lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; stands for the decimal point symbol defined by the operating system in the country-specific settings.&lt;br /&gt;
&lt;br /&gt;
The example below shows how the &amp;lt;tt&amp;gt;0&amp;lt;/tt&amp;gt; and &amp;lt;tt&amp;gt;.&amp;lt;/tt&amp;gt; characters can define the digits after the decimal point in an expression:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
MyFormat = &amp;quot;0.00&amp;quot;&lt;br /&gt;
MyString = Format(-1579.8, MyFormat)     ' Provides &amp;quot;-1579,80&amp;quot;&lt;br /&gt;
MyString = Format(1579.8, MyFormat)      ' Provides &amp;quot;1579,80&amp;quot;&lt;br /&gt;
MyString = Format(0.4, MyFormat)         ' Provides &amp;quot;0,40&amp;quot;&lt;br /&gt;
MyString = Format(0.434, MyFormat)       ' Provides &amp;quot;0,43&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In the same way, zeros can be added in front of a number to achieve the desired length:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
MyFormat = &amp;quot;0000.00&amp;quot;&lt;br /&gt;
MyString = Format(-1579.8, MyFormat)     ' Provides &amp;quot;-1579,80&amp;quot;&lt;br /&gt;
MyString = Format(1579.8, MyFormat)      ' Provides &amp;quot;1579,80&amp;quot;&lt;br /&gt;
MyString = Format(0.4, MyFormat)         ' Provides &amp;quot;0000,40&amp;quot;&lt;br /&gt;
MyString = Format(0.434, MyFormat)       ' Provides &amp;quot;0000,43&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
A &amp;lt;tt&amp;gt;,&amp;lt;/tt&amp;gt; represents the character that the operating system uses for a thousands separator, and the &amp;lt;tt&amp;gt;#&amp;lt;/tt&amp;gt; stands for a digit or place that is only displayed if it is required by the input string.&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
MyFormat = &amp;quot;#,##0.00&amp;quot;&lt;br /&gt;
MyString = Format(-1579.8, MyFormat)     ' Provides &amp;quot;-1.579,80&amp;quot;&lt;br /&gt;
MyString = Format(1579.8, MyFormat)      ' Provides &amp;quot;1.579,80&amp;quot;&lt;br /&gt;
MyString = Format(0.4, MyFormat)         ' Provides &amp;quot;0,40&amp;quot;&lt;br /&gt;
MyString = Format(0.434, MyFormat)       ' Provides &amp;quot;0,43&amp;quot;&lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
In place of the &amp;lt;tt&amp;gt;$&amp;lt;/tt&amp;gt; place holder, the &amp;lt;tt&amp;gt;Format&amp;lt;/tt&amp;gt; function displays the relevant currency symbol defined by the system (this example assumes a European locale has been defined):&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
MyFormat = &amp;quot;#,##0.00 $&amp;quot;   &lt;br /&gt;
MyString = Format(-1579.8, MyFormat)     ' Provides &amp;quot;-1.579,80 €&amp;quot; &lt;br /&gt;
MyString = Format(1579.8, MyFormat)      ' Provides &amp;quot;1.579,80 €&amp;quot; &lt;br /&gt;
MyString = Format(0.4, MyFormat)         ' Provides &amp;quot;0,40 €&amp;quot; &lt;br /&gt;
MyString = Format(0.434, MyFormat)       ' Provides &amp;quot;0,43 €&amp;quot; &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
The format instructions used in VBA for formatting date and time details can also be used:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;source lang=&amp;quot;oobas&amp;quot;&amp;gt;&lt;br /&gt;
sub main&lt;br /&gt;
    dim myDate as date&lt;br /&gt;
    myDate = &amp;quot;01/06/98&amp;quot;&lt;br /&gt;
    TestStr = Format(myDate, &amp;quot;mm-dd-yyyy&amp;quot;) ' 01-06-1998&lt;br /&gt;
    MsgBox TestStr&lt;br /&gt;
end sub &lt;br /&gt;
&amp;lt;/source&amp;gt;&lt;br /&gt;
&lt;br /&gt;
 &lt;br /&gt;
{{PDL1}}&lt;/div&gt;</summary>
		<author><name>Sancho</name></author>
		
	</entry>
</feed>