forked from amazingfate/help
Change-Id: Icdf0bdc74ea5deced0f31ee01061e46ff8b805f1 Reviewed-on: https://gerrit.libreoffice.org/c/help/+/114713 Tested-by: Jenkins Reviewed-by: Rafael Lima <rafael.palma.lima@gmail.com> Reviewed-by: Alain Romedenne <alain.romedenne@libreoffice.org>
1390 lines
117 KiB
XML
1390 lines
117 KiB
XML
<?xml version="1.0" encoding="UTF-8"?>
|
|
<helpdocument version="1.0">
|
|
<!--
|
|
* This file is part of the LibreOffice project.
|
|
*
|
|
* This Source Code Form is subject to the terms of the Mozilla Public
|
|
* License, v. 2.0. If a copy of the MPL was not distributed with this
|
|
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
|
|
*
|
|
-->
|
|
|
|
<meta>
|
|
<topic id="SF_String" indexer="include" status="PUBLISH">
|
|
<title id="tit" xml-lang="en-US">ScriptForge.String service (SF_String)</title>
|
|
<filename>/text/sbasic/shared/03/sf_string.xhp</filename>
|
|
</topic>
|
|
</meta>
|
|
|
|
<body>
|
|
<section id="ScriptForge-sf_string">
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id151579602147056">
|
|
<bookmark_value>String service</bookmark_value>
|
|
</bookmark>
|
|
</section>
|
|
|
|
<section id="abstract">
|
|
<h1 id="hd_id521580038927003" xml-lang="en-US"><variable id="StringService"><link href="text/sbasic/shared/03/sf_string.xhp" name="String service"><literal>ScriptForge</literal>.<literal>String</literal> service</link></variable></h1>
|
|
<paragraph role="paragraph" xml-lang="en-US" id="par_id351579602570526">The <literal>String</literal> service provides a collection of methods for string processing. These methods can be used to:</paragraph>
|
|
<list type="unordered">
|
|
<listitem>
|
|
<paragraph id="par_id611611952070366" role="listitem">Validate the contents of strings</paragraph>
|
|
</listitem>
|
|
<listitem>
|
|
<paragraph id="par_id611611952070376" role="listitem">Format strings by trimming, justifying or wrapping their contents</paragraph>
|
|
</listitem>
|
|
<listitem>
|
|
<paragraph id="par_id611611952070367" role="listitem">Use regular expressions to search and replace substrings</paragraph>
|
|
</listitem>
|
|
<listitem>
|
|
<paragraph id="par_id611611952070368" role="listitem">Apply hash algorithms on strings, etc.</paragraph>
|
|
</listitem>
|
|
</list>
|
|
</section>
|
|
|
|
<h2 id="hd_id961579603699855">Definitions</h2>
|
|
|
|
<h3 id="hd_id441579603838777">Line breaks</h3>
|
|
<paragraph role="paragraph" id="par_id791611946942340">The <literal>String</literal> service recognizes the following line breaks:</paragraph>
|
|
<table id="tab_id411611947117831">
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id151611947117831" role="tablehead">Symbolic name</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id721611947117831" role="tablehead">ASCII number</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id761611947117831" role="tablecontent">
|
|
Line feed<br/>
|
|
Vertical tab<br/>
|
|
Carriage return<br/>
|
|
Line feed + Carriage return<br/>
|
|
File separator<br/>
|
|
Group separator<br/>
|
|
Record separator<br/>
|
|
Next line<br/>
|
|
Line separator<br/>
|
|
Paragraph separator
|
|
</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id211611947117831" role="tablecontent" localize="false">
|
|
10 <br/> 12 <br/> 13 <br/> 10 + 13 <br/> 28 <br/> 29 <br/> 30 <br/> 133 <br/> 8232 <br/> 8233
|
|
</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
</table>
|
|
|
|
<h3 id="hd_id161579604225813">Whitespaces</h3>
|
|
<paragraph role="paragraph" id="par_id401611948279056">The <literal>String</literal> service recognizes the following whitespaces:</paragraph>
|
|
<table id="tab_id411611947117831">
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id151611947117893" role="tablehead">Symbolic name</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id721611947117855" role="tablehead">ASCII number</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id761611947117835" role="tablecontent">
|
|
Space<br/>
|
|
Horizontal tab<br/>
|
|
Line feed<br/>
|
|
Vertical tab<br/>
|
|
Form feed<br/>
|
|
Carriage return<br/>
|
|
Next line<br/>
|
|
No-break space<br/>
|
|
Line separator<br/>
|
|
Paragraph separator
|
|
</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id211611947117832" role="tablecontent" localize="false">
|
|
32 <br/> 9 <br/> 10 <br/> 11 <br/> 12 <br/> 13 <br/> 133 <br/> 160 <br/> 8232 <br/> 8233
|
|
</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
</table>
|
|
|
|
<h3 id="hd_id191580480825160">Escape sequences</h3>
|
|
<paragraph role="paragraph" id="par_id971611949145057">Below is a list of escape sequences that can be used in strings.</paragraph>
|
|
<table id="tab_id411611947117834">
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id151611947117287" role="tablehead">Escape Sequence</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id721611947117732" role="tablehead">Symbolic name</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id721611947117144" role="tablehead">ASCII number</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id771611948706049" role="tablecontent" localize="false">
|
|
\n <br/> \r <br/> \t
|
|
</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id761611947119834" role="tablecontent">
|
|
Line feed<br/>
|
|
Carriage return<br/>
|
|
Horizontal tab
|
|
</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id211611947117163" role="tablecontent" localize="false">
|
|
10 <br/> 13 <br/> 9
|
|
</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
</table>
|
|
<tip id="par_id251611949474763">To have the escape sequence "\n" interpreted as an actual string, simply use "\\n" instead of <literal>"\" & Chr(10).</literal></tip>
|
|
|
|
<h3 id="hd_id771579606799550">Non-printable characters:</h3>
|
|
<paragraph role="paragraph" id="par_id531579606877342">Characters defined in the Unicode Character Database as “Other” or “Separator” are considered as non-printable characters.</paragraph>
|
|
<paragraph role="paragraph" id="par_id221611949584320">Control characters (ascii code <= 0x1F) are also considered as non-printable.</paragraph>
|
|
|
|
<h3 id="hd_id661579604944268">Quotes inside strings:</h3>
|
|
<paragraph role="paragraph" id="par_id551579605035332">To add quotes in strings use \' (single quote) or \" (double quote). For example:</paragraph>
|
|
<list type="unordered">
|
|
<listitem>
|
|
<paragraph id="par_id201611949691285" role="listitem">The string <literal>[str\'i\'ng]</literal> is interpreted as <literal>[str'i'ng]</literal></paragraph>
|
|
</listitem>
|
|
<listitem>
|
|
<paragraph id="par_id201611949691323" role="listitem">The string <literal>[str\"i\"ng]</literal> is interpreted as <literal>[str"i"ng]</literal></paragraph>
|
|
</listitem>
|
|
</list>
|
|
|
|
<h2 id="hd_id201586594659135" xml-lang="en-US">Service invocation</h2>
|
|
<paragraph role="paragraph" id="par_id141609955500101">Before using the <literal>ScriptForge.String</literal> service the <literal>ScriptForge</literal> library needs to be loaded using:</paragraph>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id871608192694632">GlobalScope.BasicLibraries.LoadLibrary("ScriptForge")</paragraph>
|
|
</bascode>
|
|
<paragraph role="paragraph" id="par_id63158659509728" xml-lang="en-US">The following code snippets show the three ways to call methods in the <literal>String</literal> service (the <literal>ExpandTabs</literal> method is used as an example):</paragraph>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id181586594723543">SF_String.ExpandTabs(...)</paragraph>
|
|
</bascode>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id441586594733346">Dim s : s = SF_String</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id481586594739978">s.ExpandTabs(...)</paragraph>
|
|
</bascode>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id431586594750461">Dim s : s = CreateScriptService("String")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id471586594758689">s.ExpandTabs(...)</paragraph>
|
|
</bascode>
|
|
|
|
<h2 id="hd_id651584978211886" xml-lang="en-US">Properties</h2>
|
|
<paragraph role="paragraph" id="par_id241611950267068">The <literal>SF_String</literal> object provides the following properties:</paragraph>
|
|
<table id="tab_id761584978211275">
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id271584978211792" role="tablehead" xml-lang="en-US">Name</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id241584978211550" role="tablehead" xml-lang="en-US">ReadOnly</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id621584978211403" role="tablehead" xml-lang="en-US">Description</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id581584978715552" role="tablecontent" xml-lang="en-US" localize="false">sfCR</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id71584978715562" role="tablecontent" xml-lang="en-US">Yes</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id581584978715701" role="tablecontent" xml-lang="en-US">Carriage return: Chr(13)</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id91584978211231" role="tablecontent" xml-lang="en-US" localize="false">sfCRLF</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id211584978211383" role="tablecontent" xml-lang="en-US">Yes</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id691584978211774" role="tablecontent" xml-lang="en-US">Carriage return + Linefeed: Chr(13) & Chr(10)</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id1001584978666440" role="tablecontent" xml-lang="en-US" localize="false">sfLF</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id671584978666689" role="tablecontent" xml-lang="en-US">Yes</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id951584978666296" role="tablecontent" xml-lang="en-US">Linefeed: Chr(10)</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id311584978666162" role="tablecontent" xml-lang="en-US" localize="false">sfNEWLINE</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id421584978666327" role="tablecontent" xml-lang="en-US">Yes</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id901584978666158" role="tablecontent" xml-lang="en-US">Carriage return + Linefeed, which can be<br/>1) Chr(13) & Chr(10) or
|
|
<br/>2) Linefeed: Chr(10)
|
|
<br/>depending on the operating system.</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id371584978666469" role="tablecontent" xml-lang="en-US" localize="false">sfTAB</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id541584978666991" role="tablecontent" xml-lang="en-US">Yes</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id741584978666508" role="tablecontent" xml-lang="en-US">Horizontal tabulation: Chr(9)</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
</table>
|
|
<tip id="par_id461584978880380" xml-lang="en-US">You can use the properties above to identify or insert the corresponding characters inside strings. For example, the Linefeed can be replaced by <literal>SF_String.sfLF</literal>.</tip>
|
|
|
|
<table id="tab_id501611613601554">
|
|
<tablerow>
|
|
<tablecell colspan="3"><paragraph id="par_id891611613601554" role="tablehead" localize="false">List of Methods in the String Service</paragraph></tablecell>
|
|
</tablerow>
|
|
<tablerow>
|
|
<tablecell>
|
|
<paragraph id="par_id891611613601556" role="tablecontent" localize="false">
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#Capitalize" name="Capitalize method">Capitalize</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#Count" name="Count method">Count</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#EndsWith" name="EndsWith method">EndsWith</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#Escape" name="Escape method">Escape</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#ExpandTabs" name="ExpandTabs method">ExpandTabs</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#FilterNotPrintable" name="FilterNotPrintable method">FilterNotPrintable</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#FindRegex" name="FindRegex method">FindRegex</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#HashStr" name="HashStr method">HashStr</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#HtmlEncode" name="HtmlEncode method">HtmlEncode</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsADate" name="IsADate method">IsADate</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsAlpha" name="IsAlpha method">IsAlpha</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsAlphaNum" name="IsAlphaNum method">IsAlphaNum</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsAscii" name="IsAscii method">IsAscii</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsDigit" name="IsDigit method">IsDigit</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsEmail" name="IsEmail method">IsEmail</link><br/>
|
|
</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id541611613601554" role="tablecontent" localize="false">
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsFileName" name="IsFileName method">IsFileName</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsHexDigit" name="IsHexDigit method">IsHexDigit</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsIPv4" name="IsIBAN method">IsIBAN</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsIPv4" name="IsIPv4 method">IsIPv4</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsLike" name="IsLike method">IsLike</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsLower" name="IsLower method">IsLower</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsPrintable" name="IsPrintable method">IsPrintable</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsRegex" name="IsRegex method">IsRegex</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsSheetName" name="IsSheetName method">IsSheetName</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsTitle" name="IsTitle method">IsTitle</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsUpper" name="IsUpper method">IsUpper</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsUrl" name="IsUrl method">IsUrl</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#IsWhitespace" name="IsWhitespace method">IsWhitespace</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#JustifyCenter" name="JustifyCenter method">JustifyCenter</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#JustifyLeft" name="JustifyLeft method">JustifyLeft</link><br/><br/>
|
|
</paragraph>
|
|
</tablecell>
|
|
<tablecell>
|
|
<paragraph id="par_id701611613601554" role="tablecontent" localize="false">
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#JustifyRight" name="JustifyRight method">JustifyRight</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#Quote" name="Quote method">Quote</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#ReplaceChar" name="ReplaceChar method">ReplaceChar</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#ReplaceRegex" name="ReplaceRegex method">ReplaceRegex</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#ReplaceStr" name="ReplaceStr method">ReplaceStr</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#Represent" name="Represent method">Represent</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#Reverse" name="Reverse method">Reverse</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#SplitLines" name="SplitLines method">SplitLines</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#SplitNotQuoted" name="SplitNotQuoted method">SplitNotQuoted</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#StartsWith" name="StartsWith method">StartsWith</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#TrimExt" name="TrimExt method">TrimExt</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#Unescape" name="Unescape method">Unescape</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#Unquote" name="Unquote method">Unquote</link><br/>
|
|
<link href="text/sbasic/shared/03/sf_string.xhp#Wrap" name="Wrap method">Wrap</link><br/><br/>
|
|
</paragraph>
|
|
</tablecell>
|
|
</tablerow>
|
|
</table>
|
|
<note id="par_id151611951803163">The first argument of most methods is the string to be considered. It is always passed by reference and left unchanged. Methods such as <literal>Capitalize</literal>, <literal>Escape</literal>, etc return a new string after their execution.</note>
|
|
|
|
<section id="Capitalize">
|
|
<comment> Capitalize -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id121582203710297">
|
|
<bookmark_value>String service;Capitalize</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id791579683635979" localize="false">Capitalize</h2>
|
|
<paragraph role="paragraph" id="par_id271579683706571">Capitalizes the first character from each word in the input string.</paragraph>
|
|
<h3 id="hd_id381579687079872" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id531579684617249">SF_String.Capitalize(InputStr As String) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id791582304381135" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id941582304592013"><emph>InputStr</emph>: The string to be capitalized.</paragraph>
|
|
<h3 id="hd_id181579683940500" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id631579688532444">Dim sName as String : sName = "john smith"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id451579686015963">Dim sCapitalizedName as String</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id41579785318230">sCapitalizedName = SF_String.Capitalize(sName)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id801579688542131">MsgBox sCapitalizedName 'John Smith</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="Count">
|
|
<comment> Count -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" branch="index" id="bm_id421582384432626" localize="false">
|
|
<bookmark_value>String service;Count</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id1001582384527265" localize="false">Count</h2>
|
|
<paragraph role="paragraph" id="par_id891582384556756">Counts the number of occurrences of a substring or a regular expression within a string.</paragraph>
|
|
<h3 id="hd_id561582384583468" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id541582384611917">SF_String.Count(InputStr As String, Substring As String[, IsRegex As Boolean][, CaseSensitive As Boolean]) As Long</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id471582384639119" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id571582384689863"><emph>InputStr</emph>: The input string to be examined</paragraph>
|
|
<paragraph role="paragraph" id="par_id601582384696486"><emph>Substring</emph>: The substring or the regular expression to be used during search</paragraph>
|
|
<paragraph role="paragraph" id="par_id451582384703719"><emph>IsRegex</emph>: Use <literal>True</literal> if the substring is a regular expression (default = <literal>False</literal>)</paragraph>
|
|
<paragraph role="paragraph" id="par_id141582384726168"><emph>CaseSensitive</emph>: Default = <literal>False</literal></paragraph>
|
|
<h3 id="hd_id1001582384736960" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" id="bas_id371582384749769">'Counts the occurrences of the substring "or" inside the input string (returns 2)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id281582384809689">MsgBox SF_String.Count("Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "or", CaseSensitive := False)</paragraph>
|
|
<paragraph role="bascode" id="bas_id561582384801586">'Counts the number of words with only lowercase letters (returns 7)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id631582384780777">MsgBox SF_String.Count("Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "\b[a-z]+\b", IsRegex := True, CaseSensitive := True)</paragraph>
|
|
</bascode>
|
|
<tip id="par_id131612223767126">To learn more about regular expressions, refer to the Python's documentation on <link href="https://docs.python.org/3/library/re.html" name="Regular expressions">Regular Expression Operations</link>.</tip>
|
|
</section>
|
|
|
|
<section id="EndsWith">
|
|
<comment> EndsWith -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id771582203795803">
|
|
<bookmark_value>String service;EndsWith</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id801579687630238" localize="false">EndsWith</h2>
|
|
<paragraph role="paragraph" id="par_id581579687739629">Returns <literal>True</literal> if a string ends with a specified substring.</paragraph>
|
|
<paragraph role="paragraph" id="par_id21612306392239">The function returns <literal>False</literal> when either the string or the substring have a length = 0 or when the substring is longer than the string.</paragraph>
|
|
<h3 id="hd_id171579860926083" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id411579861070487">SF_String.EndsWith(InputStr As String, Substring As String[, CaseSensitive As Boolean]) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id531579861378017" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id191579861552201"><emph>InputStr</emph>: The string to be tested.</paragraph>
|
|
<paragraph role="paragraph" id="par_id211579861561473"><emph>Substring</emph>: The substring to be searched at the end of <literal>InputStr</literal>.</paragraph>
|
|
<paragraph role="paragraph" id="par_id801579861574009"><emph>CaseSensitive</emph>: The comparison can be case sensitive or not (default = <literal>False</literal>).</paragraph>
|
|
<h3 id="hd_id281579862794982" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" id="bas_id811579862998452">'Returns True because the method was called with the default CaseSensitive = False</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id581579863063364">MsgBox SF_String.EndsWith("abcdefg", "EFG")</paragraph>
|
|
<paragraph role="bascode" id="bas_id231579863168747">'Returns False due to the CaseSensitive parameter</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id221579863071644">MsgBox SF_String.EndsWith("abcdefg", "EFG", CaseSensitive := True)</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="Escape">
|
|
<comment> Escape -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id731585921441446">
|
|
<bookmark_value>String service;Escape</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id821585921441213" localize="false">Escape</h2>
|
|
<paragraph role="paragraph" id="par_id921585921441429">Converts linebreaks and tabs contained in the input string to their equivalent escaped sequence (\\, \n, \r, \t).</paragraph>
|
|
<h3 id="hd_id61585921441151" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id581585921441246">SF_String.Escape(InputStr As String) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id841585921441890" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id9158592144110"><emph>InputStr</emph>: The string to be converted.</paragraph>
|
|
<h3 id="hd_id60158592144145" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" id="bas_id901585921441483">'Returns the string "abc\n\tdef\\n"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id741585921441977">MsgBox SF_String.Escape("abc" & Chr(10) & Chr(9) & "def\n")</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="ExpandTabs">
|
|
<comment> ExpandTabs -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id161582203880251">
|
|
<bookmark_value>String service;ExpandTabs</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id761579868039113" localize="false">ExpandTabs</h2>
|
|
<paragraph role="paragraph" id="par_id271579868053137">Replaces Tab characters <literal>Chr(9)</literal> by space characters to replicate the behavior of tab stops.</paragraph>
|
|
<paragraph role="paragraph" id="par_id951579868064344">If a line break is found, a new line is started and the character counter is reset.</paragraph>
|
|
<h3 id="hd_id131579868074952" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id161579868246119">SF_String.ExpandTabs(InputStr As String[, TabSize As Integer]) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id551579868261335" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id231579868290408"><emph>InputStr</emph>: The string to be expanded</paragraph>
|
|
<paragraph role="paragraph" id="par_id281579868299807"><emph>TabSize</emph>: This parameter is used to determine the Tab stops using the formula: TabSize + 1, 2 * TabSize + 1 , ... N * TabSize + 1 (default = 8)</paragraph>
|
|
<h3 id="hd_id691579868460957" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id611579868690878">Dim myText as String</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id931585922081615">myText = "100" & SF_String.sfTAB & "200" & SF_String.sfTAB & "300" & SF_String.sfNEWLINE & _</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id311579868703742"> "X" & SF_String.sfTAB & "Y" & SF_String.sfTAB & "Z"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id841585921966229">MsgBox SF_String.ExpandTabs(myText)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id461579868714135">'100 200 300</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id461579868714136">'X Y Z</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="FilterNotPrintable">
|
|
<comment> FilterNotPrintable -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id231582204001536">
|
|
<bookmark_value>String service;FilterNotPrintable</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id581579874537114" localize="false">FilterNotPrintable</h2>
|
|
<paragraph role="paragraph" id="par_id161579874552729">Replaces all non-printable characters in the input string by a given character.</paragraph>
|
|
<h3 id="hd_id521579874572260" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id141579874588279">SF_String.FilterNotPrintable(InputStr As String[, ReplacedBy As String]) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id471579874607847" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id431579874633865"><emph>InputStr</emph>: The string to be searched</paragraph>
|
|
<paragraph role="paragraph" id="par_id31579874656437"><emph>ReplacedBy</emph>: Zero, one or more characters that will replace all non-printable characters in <literal>InputStr</literal> (Default = "")</paragraph>
|
|
<h3 id="hd_id661579874669320" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id481579874686887">Dim LF : LF = Chr(10)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id41579874696422">Dim myText as String</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id611579874737551">myText = "àén ΣlPµ" & LF & " Русский" & "\n"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id271579874750894">MsgBox SF_String.FilterNotPrintable(myText)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id81612308364024">' "àén ΣlPµ Русский\n"</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="FindRegex">
|
|
<comment> FindRegex -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id491582204303825">
|
|
<bookmark_value>String service;FindRegex</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id471579876212449" localize="false">FindRegex</h2>
|
|
<paragraph role="paragraph" id="par_id1001579876228707">Finds in a string a substring matching a given regular expression.</paragraph>
|
|
<h3 id="hd_id81579876242016" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id661579876255913">SF_String.FindRegex(InputStr As String, Regex As String[, Start As Long[, CaseSensitive As Boolean[, Forward As Boolean]]]) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id561579876264354" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id131579876314120"><emph>InputStr</emph>: The string to be searched</paragraph>
|
|
<paragraph role="paragraph" id="par_id751579876371545"><emph>Regex</emph>: The regular expression</paragraph>
|
|
<paragraph role="paragraph" id="par_id881579876394584"><emph>Start</emph>: The position in the string where the search will begin. This parameter is passed by reference, so after execution the value of <literal>Start</literal> will point to the first character of the found substring. If no matching substring is found, <literal>Start</literal> will be set to 0.</paragraph>
|
|
<paragraph role="paragraph" id="par_id251579876403831"><emph>CaseSensitive</emph>: Default = <literal>False</literal></paragraph>
|
|
<paragraph role="paragraph" id="par_id841579876412287"><emph>Forward</emph>: Determines the direction of the search. If <literal>True</literal>, search moves forward. If <literal>False</literal> search moves backwards (Default = <literal>True</literal>)</paragraph>
|
|
<paragraph role="paragraph" id="par_id451612309155653">At the first iteration, if <literal>Forward = True</literal>, then <literal>Start</literal> should be equal to 1, whereas if <literal>Forward = False</literal> then <literal>Start</literal> should be equal to <literal>Len(InputStr)</literal></paragraph>
|
|
<h3 id="hd_id651579876420512" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id621579876463377">Dim lStart As Long : lStart = 1</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id1001579876429088">Dim result as String</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id571579876474344">result = SF_String.FindRegex("abCcdefghHij", "C.*H", lStart, CaseSensitive := True)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id671579876511592">MsgBox lStart & ": " & result</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id51579876497768">'3: CcdefghH</paragraph>
|
|
</bascode>
|
|
<tip id="par_id221612309579001">In the example above, the new value of <literal>lStart</literal> can be used to keep searching the same input string by setting the <literal>Start</literal> parameter to <literal>lStart + Len(result)</literal> at the next iteration.</tip>
|
|
</section>
|
|
|
|
<section id="HashStr">
|
|
<comment> HashStr -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id24160104898372">
|
|
<bookmark_value>String service;HashStr</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id871601048983883" localize="false">HashStr</h2>
|
|
<paragraph role="paragraph" id="par_id471601048983628">Hash functions are used inside some cryptographic algorithms, in digital signatures, message authentication codes, manipulation detection, fingerprints, checksums (message integrity check), hash tables, password storage and much more.</paragraph>
|
|
<paragraph role="paragraph" id="par_id301601048983765" xml-lang="en-US">The <literal>HashStr</literal> method returns the result of a hash function applied on a given string and using a specified algorithm, as a string of lowercase hexadecimal digits.</paragraph>
|
|
<paragraph role="paragraph" id="par_id631601048983149" xml-lang="en-US">The hash algorithms supported are: <literal>MD5</literal>, <literal>SHA1</literal>, <literal>SHA224</literal>, <literal>SHA256</literal>, <literal>SHA384</literal> and <literal>SHA512</literal>.</paragraph>
|
|
<h3 id="hd_id501601048983376" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id841601048983230">SF_String.HashStr(InputStr As String, Algorithm As String) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id231601048983458" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id621601048983210"><emph>InputStr</emph> : The string to hash. It is presumed to be encoded in UTF-8. The hashing algorithm will consider the string as a stream of bytes.</paragraph>
|
|
<paragraph role="paragraph" id="par_id941601048983822" xml-lang="en-US"><emph>Algorithm</emph> : One of the supported algorithms listed above, passed as a string.</paragraph>
|
|
<h3 id="hd_id11601048983215" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id721601048983555">MsgBox SF_String.HashStr("œ∑¡™£¢∞§¶•ªº–≠œ∑´®†¥¨ˆøπ‘åß∂ƒ©˙∆˚¬", "MD5")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id891612351766467">' c740ccc2e201df4b2e2b4aa086f35d8a</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="HtmlEncode">
|
|
<comment> HtmlEncode -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id561582204334292">
|
|
<bookmark_value>String service;HtmlEncode</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id771579879504956" localize="false">HtmlEncode</h2>
|
|
<paragraph role="paragraph" id="par_id221579879516929">Encodes the input string into the HTML character codes, replacing special characters by their <literal>&</literal> counterparts.</paragraph>
|
|
<paragraph role="paragraph" id="par_id341612351999692">For example, the character <literal>é</literal> would be replaced by <literal>&eacute;</literal> or an equivalent numerical HTML code.</paragraph>
|
|
<h3 id="hd_id41579879526291" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id291579879535883">SF_String.HtmlEncode(InputStr) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id331579879545045" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="bas_id501579879570781"><emph>InputStr</emph>: The string to encode</paragraph>
|
|
<h3 id="hd_id451579880024971" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id671579879597547">MsgBox SF_String.HtmlEncode("<a href=""https://a.b.com"">From α to ω</a>")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id461579879607044">' "&lt;a href=&quot;https://a.b.com&quot;&gt;From &#945; to &#969;&lt;/a&gt;"</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsADate">
|
|
<comment> IsADate -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id11582204732653">
|
|
<bookmark_value>String service;IsADate</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id141579880967392" localize="false">IsADate</h2>
|
|
<paragraph role="paragraph" id="par_id171579880990533">Returns <literal>True</literal> if the input string is a valid date according to a specified date format.</paragraph>
|
|
<h3 id="hd_id401579881016326" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id361579881029686">SF_String.IsADate(InputStr As String[, DateFormat As String]) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id571579881041949" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id151579881091821"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal></paragraph>
|
|
<paragraph role="paragraph" id="par_id991579881107670"><emph>DateFormat</emph>: The date format, as a string. It can be either "YYYY-MM-DD" (default), "DD-MM-YYYY" or "MM-DD-YYYY"</paragraph>
|
|
<paragraph role="paragraph" id="par_id291579881117126">The dash (-) may be replaced by a dot (.), a slash (/) or a space.</paragraph>
|
|
<paragraph role="paragraph" id="par_id51579881125801"> If the format is invalid, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id531579881133911" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id811579881155015">MsgBox SF_String.IsADate("2020-12-31", "YYYY-MM-DD") ' True</paragraph>
|
|
</bascode>
|
|
<note id="par_id211612370427721">This method checks the format of the input string without performing any calendar-specific checks. Hence it does not test the input string for leap years or months with 30 or 31 days. For that, refer to the <link href="text/sbasic/shared/03102300.xhp" name="IsDate function"><literal>IsDate</literal> built-in function</link>.</note>
|
|
<paragraph role="paragraph" id="par_id181612371147364">The example below shows the difference between the methods <literal>IsADate</literal> (ScriptForge) and the <literal>IsDate</literal> (built-in) function.</paragraph>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id531612371248704">Dim myDate as String : myDate = "2020-02-30"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id731612371253577">MsgBox SF_String.IsADate(myDate, "YYYY-MM-DD") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id821612371254969">MsgBox IsDate(myDate) 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsAlpha">
|
|
<comment> IsAlpha -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id491582204781995">
|
|
<bookmark_value>String service;IsAlpha</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id231579881589037" localize="false">IsAlpha</h2>
|
|
<paragraph role="paragraph" id="par_id161579881600317">Returns <literal>True</literal> if all characters in the string are alphabetic.</paragraph>
|
|
<paragraph role="paragraph" id="par_id251579881615469">Alphabetic characters are those characters defined in the <link href="https://unicode.org/reports/tr44/" name="Unicode documentation">Unicode Character Database</link> as <literal>Letter</literal>.</paragraph>
|
|
<h3 id="hd_id121579881624613" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id471579881638941">SF_String.IsAlpha(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id921579881654036" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id11579881691826"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id841579881714210" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="par_id381579881735058">MsgBox SF_String.IsAlpha("àénΣlPµ") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id331579881743363">MsgBox SF_String.IsAlpha("myVar3") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsAlphaNum">
|
|
<comment> IsAlphaNum -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id581582204814414">
|
|
<bookmark_value>String service;IsAlphanum</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id711579883155335" localize="false">IsAlphaNum</h2>
|
|
<paragraph role="paragraph" id="par_id421579883181382">Returns <literal>True</literal> if all characters in the string are alphabetic, digits or "_" (underscore). The first character must not be a digit.</paragraph>
|
|
<h3 id="hd_id791579884249419" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id401579884443738">SF_String.IsAlphaNum(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id171579884263682" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id31579884464101"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id981579884354378" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id611579884379482">MsgBox SF_String.IsAlphaNum("_ABC_123456_abcàénΣlPµ") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id551612445915119">MsgBox SF_String.IsAlphaNum("123ABC") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsAscii">
|
|
<comment> IsAscii -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id991582204833033">
|
|
<bookmark_value>String service;IsAscii</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id891580039448798" localize="false">IsAscii</h2>
|
|
<paragraph role="paragraph" id="par_id671580039484786">Returns <literal>True</literal> if all characters in the string are Ascii characters.</paragraph>
|
|
<h3 id="hd_id221580039493808" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id471580039537321">SF_String.IsAscii(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id891580039510727" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id791580039528838"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id91580039546153" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id41580039556401">MsgBox SF_String.IsAscii("a%?,25") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id841580039565265">MsgBox SF_String.IsAscii("abcàénΣlPµ") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsDigit">
|
|
<comment> IsDigit -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id741582204858557">
|
|
<bookmark_value>String service;IsDigit</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id321580044756464" localize="false">IsDigit</h2>
|
|
<paragraph role="paragraph" id="par_id861580044805749">Returns <literal>True</literal> if all characters in the string are digits.</paragraph>
|
|
<h3 id="hd_id341580044817581" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id601580044829921">SF_String.IsDigit(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id571580044844060" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id41580044873043"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id741580044902750" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id821580044929100">MsgBox SF_String.IsDigit("123456") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id601580044939971">MsgBox SF_String.IsDigit("_12a") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsEmail">
|
|
<comment> IsEmail -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id721582204903245">
|
|
<bookmark_value>String service;IsEmail</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id601580045208963" localize="false">IsEmail</h2>
|
|
<paragraph role="paragraph" id="par_id521580045221758">Returns <literal>True</literal> if the string is a valid email address.</paragraph>
|
|
<h3 id="hd_id221580045240298" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id791580045251493">SF_String.IsEmail(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id691580045263571" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id841580045280071"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id641580045286520" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id351580045300802">MsgBox SF_String.IsEmail("first.last@something.org") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id511580045308668">MsgBox SF_String.IsEmail("first.last@something.com.br") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id621580045319466">MsgBox SF_String.IsEmail("first.last@something.123") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsFileName">
|
|
<comment> IsFileName -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id601582204928759">
|
|
<bookmark_value>String service;IsFileName</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id941580047025136" localize="false">IsFileName</h2>
|
|
<paragraph role="paragraph" id="par_id41580047039666">Returns <literal>True</literal> if the string is a valid filename in a given operating system.</paragraph>
|
|
<h3 id="hd_id321580047047967" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id601580047059045">SF_String.IsFileName(InputStr As String[, OSName As String]) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id961580047067350" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id801580047079938"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<paragraph role="paragraph" id="par_id781580047088954"><emph>OSName</emph>: The operating system name, as a string. It can be WINDOWS, LINUX, MACOSX or SOLARIS.</paragraph>
|
|
<paragraph role="paragraph" id="par_id991612372824234">The default value is the current operating system on which the script is running.</paragraph>
|
|
<h3 id="hd_id281580047193387" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id291580047101783">MsgBox SF_String.IsFileName("~/Documents/a file name.odt", "LINUX") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id761580047111201">MsgBox SF_String.IsFileName("C:\home\a file name.odt", "LINUX") 'False</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id901580047128532">MsgBox SF_String.IsFileName("C:\home\a file name.odt", "WINDOWS") 'True</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsHexDigit">
|
|
<comment> IsHexDigit -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id1001582204955266">
|
|
<bookmark_value>String service;IsHexDigit</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id441580047541078" localize="false">IsHexDigit</h2>
|
|
<paragraph role="paragraph" id="par_id911580047551929">Returns <literal>True</literal> if all characters in the string are hexadecimal digits.</paragraph>
|
|
<h3 id="hd_id711580047561024" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id1001580047573400">SF_String.IsHexDigit(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id931580047579878" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id331580047594144"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<paragraph role="paragraph" id="par_id521612377109554">The hexadecimal digits may be prefixed with "0x" or "&H".</paragraph>
|
|
<h3 id="hd_id771580047603896" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id51580047615488">MsgBox SF_String.IsHexDigit("&H00FF") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id251580047624832">MsgBox SF_String.IsHexDigit("08AAFF10") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id281580047636521">MsgBox SF_String.IsHexDigit("0x18LA22") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsIBAN">
|
|
<comment> IsIBAN -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id931582204907784">
|
|
<bookmark_value>String service;IsIBAN</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id431580840408317" localize="false">IsIBAN</h2>
|
|
<paragraph role="paragraph" id="par_id791584008420941">Returns <literal>True</literal> if the string is a valid International Bank Account Number (IBAN). The comparison is not case-sensitive.</paragraph>
|
|
<embed href="text/sbasic/shared/03/avail_release.xhp#7.2.method"/>
|
|
<h3 id="hd_id9615004808430925" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id371584008441769">SF_String.IsIBAN(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id671580840452527" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id951880048466565"> <emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id251619526510787" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functvalue"/></h3>
|
|
<paragraph role="paragraph" id="par_id631619526542367"><literal>True</literal> if the string contains a valid IBAN number.</paragraph>
|
|
<h3 id="hd_id321580048473256" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id571500848484444">MsgBox SF_String.IsIBAN("BR15 0000 0000 0000 1093 2840 814 P2") 'returns True</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsIPv4">
|
|
<comment> IsIPv4 -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id931582204977084">
|
|
<bookmark_value>String service;IsIPv4</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id431580048408317" localize="false">IsIPv4</h2>
|
|
<paragraph role="paragraph" id="par_id791580048420941">Returns <literal>True</literal> if the string is a valid IP(v4) address.</paragraph>
|
|
<h3 id="hd_id961580048430925" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id371580048441769">SF_String.IsIPv4(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id671580048452527" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id981580048466565"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id321580048473652" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id571580048484444">MsgBox SF_String.IsIPv4("192.168.1.50") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id871580048493061">MsgBox SF_String.IsIPv4("192.168.50") 'False</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id201580048501038">MsgBox SF_String.IsIPv4("255.255.255.256") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsLike">
|
|
<comment> IsLike -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id721582205008767">
|
|
<bookmark_value>String service;IsLike</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id791580049073672" localize="false">IsLike</h2>
|
|
<paragraph role="paragraph" id="par_id831580049093038">Returns <literal>True</literal> if the whole input string matches a given pattern containing wildcards.</paragraph>
|
|
<h3 id="hd_id421580049106642" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id21580049118331">SF_String.IsLike(InputStr As String, Pattern As String[, CaseSensitive As Boolean) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id331580049127289" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id141580049142548"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<paragraph role="paragraph" id="par_id31580049154551"><emph>Pattern</emph>: The pattern as a string. Wildcard are:</paragraph>
|
|
<list type="unordered">
|
|
<listitem>
|
|
<paragraph id="par_id181612441703306" role="listitem">"?" represents any single character;</paragraph>
|
|
</listitem>
|
|
<listitem>
|
|
<paragraph role="paragraph" id="par_id861612377611438">"*" represents zero, one, or multiple characters.</paragraph>
|
|
</listitem>
|
|
</list>
|
|
<paragraph role="paragraph" id="par_id991580049206617"><emph>CaseSensitive</emph>: Default = <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id501580049216181" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id541580049238484">MsgBox SF_String.IsLike("aAbB", "?A*") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id821580049249434">MsgBox SF_String.IsLike("C:\a\b\c\f.odb", "?:*.*") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id981580049258743">MsgBox SF_String.IsLike("name:host", "?*@?*") 'False</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id821612378053774">MsgBox SF_String.IsLike("@host", "?*@?*") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsLower">
|
|
<comment> IsLower -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id91582205043650">
|
|
<bookmark_value>String service;IsLower</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id621580050021403" localize="false">IsLower</h2>
|
|
<paragraph role="paragraph" id="par_id581580050048679">Returns <literal>True</literal> if all characters in the string are in lowercase. Non-alphabetic characters are ignored.</paragraph>
|
|
<h3 id="hd_id31580050058813" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id101580050073550">SF_String.IsLower(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id421580050086302" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id751580050122938"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id201580050136558" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id731580050158022">MsgBox SF_String.IsLower("abc'(-xy4z") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id881580050187982">MsgBox SF_String.IsLower("1234") ' True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id741580050198046">MsgBox SF_String.IsLower("abcDefg") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsPrintable">
|
|
<comment> IsPrintable -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id71582205064134">
|
|
<bookmark_value>String service;IsPrintable</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id51580051636185" localize="false">IsPrintable</h2>
|
|
<paragraph role="paragraph" id="par_id231580051650488">Returns <literal>True</literal> if all characters in the string are printable.</paragraph>
|
|
<h3 id="hd_id161580051662224" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id161580051674896">SF_String.IsPrintable(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id71580051688352" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id721580051706431"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id851580051716753" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id341580051737598">MsgBox SF_String.IsPrintable("àén ΣlPµ Русский") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id791580051747813">MsgBox SF_String.IsPrintable("First line." & Chr(10) & "Second Line.") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsRegex">
|
|
<comment> IsRegex -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id561582205088656">
|
|
<bookmark_value>String service;IsRegex</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id11580052383614" localize="false">IsRegex</h2>
|
|
<paragraph role="paragraph" id="par_id281580052400960">Returns <literal>True</literal> if the whole input string matches a given regular expression.</paragraph>
|
|
<h3 id="hd_id791580052417893" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id701580052429005">SF_String.IsRegex(InputStr As String, Regex As String[, CaseSensitive As Boolean) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id601580052440449" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id161580052454770"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<paragraph role="paragraph" id="par_id581580052467973"><emph>Regex</emph>: The regular expression. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<paragraph role="paragraph" id="par_id621580052654341"><emph>CaseSensitive</emph>: Default = <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id331580052489089" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id711580052523722">MsgBox SF_String.IsRegex("aAbB", "[A-Za-z]+") ' True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id431580052508625">MsgBox SF_String.IsRegex("John;100", "[A-Za-z]+;[0-9]+") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id71580052534405">MsgBox SF_String.IsRegex("John;100;150", "[A-Za-z]+;[0-9]+") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsSheetName">
|
|
<comment> IsSheetName -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id901589460240654">
|
|
<bookmark_value>String service;IsSheetName</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id791589460240472" localize="false">IsSheetName</h2>
|
|
<paragraph role="paragraph" id="par_id1001589460240467">Returns <literal>True</literal> if the input string is a valid Calc sheet name.</paragraph>
|
|
<h3 id="hd_id611589460240747" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id311589460240897">SF_String.IsSheetName(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id961589460240420" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id671589460240552"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id31589460240398" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id391589460240928">MsgBox SF_String.IsSheetName("1àbc + ""déf""") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id681589460240214">MsgBox SF_String.IsSheetName("[MySheet]") 'False</paragraph>
|
|
</bascode>
|
|
<note id="par_id551612442002823">A sheet name must not contain the characters [ ] * ? : / \ or the character ' (apostrophe) as first or last character.</note>
|
|
</section>
|
|
|
|
<section id="IsTitle">
|
|
<comment> IsTitle -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id461582205108468">
|
|
<bookmark_value>String service;IsTitle</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id571580293080317" localize="false">IsTitle</h2>
|
|
<paragraph role="paragraph" id="par_id371580293093655">Returns <literal>True</literal> if the first character of every word is in uppercase and the other characters are in lowercase.</paragraph>
|
|
<h3 id="hd_id251580293102404" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id631580293112685">SF_String.IsTitle(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id281580293123911" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id471580293142283"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id381580293153093" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id701580293163557">MsgBox SF_String.IsTitle("This Is The Title Of My Book") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id371580293175037">MsgBox SF_String.IsTitle("This is the Title of my Book") 'False</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id1001580293184622">MsgBox SF_String.IsTitle("Result Number 100") 'True</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsUpper">
|
|
<comment> IsUpper -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id31582205124227">
|
|
<bookmark_value>String service;IsUpper</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id341580128661190" localize="false">IsUpper</h2>
|
|
<paragraph role="paragraph" id="par_id801580128672004">Returns <literal>True</literal> if all characters in the string are in uppercase. Non alphabetic characters are ignored.</paragraph>
|
|
<h3 id="hd_id921580128693386" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id251580128706130">SF_String.IsUpper(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id401580128717423" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id391580128736809"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id311580128746222" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id81580128769670">MsgBox SF_String.IsUpper("ABC'(-XYZ") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id951580128785698">MsgBox SF_String.IsUpper("A Title") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsUrl">
|
|
<comment> IsUrl -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id431582205169135">
|
|
<bookmark_value>String service;IsUrl</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id211580132006615" localize="false">IsUrl</h2>
|
|
<paragraph role="paragraph" id="par_id531580132067813">Returns <literal>True</literal> if the string is a valid absolute URL (Uniform Resource Locator) address. Only the http, https and ftp protocols are supported.</paragraph>
|
|
<h3 id="hd_id861580132076796" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id121580132087917">SF_String.IsUrl(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id591580132097114" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id321580132113593"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id51580132120676" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id41580132143630">MsgBox SF_String.IsUrl("http://foo.bar/?q=Test%20URL-encoded%20stuff") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id811580132160302">MsgBox SF_String.IsUrl("www.somesite.org") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="IsWhitespace">
|
|
<comment> IsWhitespace -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id551582205196046">
|
|
<bookmark_value>String service;IsWhitespace</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id401580132462319" localize="false">IsWhitespace</h2>
|
|
<paragraph role="paragraph" id="par_id41580132491698">Returns <literal>True</literal> if all characters in the string are whitespaces</paragraph>
|
|
<h3 id="hd_id821580132503183" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id731580132516185">SF_String.IsWhitespace(InputStr As String) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id241580132526242" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id801580132535511"><emph>InputStr</emph>: The string to be checked. If empty, the method returns <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id691580132546751" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id71580132555742">MsgBox SF_String.IsWhitespace(" ") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id191580132564154">MsgBox SF_String.IsWhitespace(" " & Chr(9) & Chr(10)) 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id531580132571745">MsgBox SF_String.IsWhitespace("") 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="JustifyCenter">
|
|
<comment> JustifyCenter -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id421582205214600">
|
|
<bookmark_value>String service;JustifyCenter</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id291580133287288" localize="false">JustifyCenter</h2>
|
|
<paragraph role="paragraph" id="par_id891580133307100">Returns the input string center-justified.</paragraph>
|
|
<paragraph role="paragraph" id="par_id571612380829021">The leading and trailing white spaces are stripped and the remaining characters are completed left and right up to a specified total <literal>Length</literal> with the character <literal>Padding</literal>.</paragraph>
|
|
<h3 id="hd_id531580133318829" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id931580133518123">SF_String.JustifyCenter(InputStr As String[, Length As Long[, Padding As String]]) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id971580133380548" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id911580133391827"><emph>InputStr</emph>: The string to be center-justified. If empty, the method returns an empty string.</paragraph>
|
|
<paragraph role="paragraph" id="par_id671580133694946"><emph>Length</emph>: The length of the resulting string (default = the length of the input string).</paragraph>
|
|
<paragraph role="paragraph" id="par_id511612381090109">If the specified length is shorter than the center-justified input string, then the returned string is truncated.</paragraph>
|
|
<paragraph role="paragraph" id="par_id101580133705268"><emph>Padding</emph>: The single character to be used as padding (default = the Ascii space " ").</paragraph>
|
|
<h3 id="hd_id471580133425364" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id121580133437963">MsgBox SF_String.JustifyCenter("Title", Length := 11) ' " Title "</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id701580133452083">MsgBox SF_String.JustifyCenter(" ABCDE", Padding := "_") ' "__ABCDEF__"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id841580133480737">MsgBox SF_String.JustifyCenter("A Long Title", Length := 5) ' "ong T"</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="JustifyLeft">
|
|
<comment> JustifyLeft -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id351582205243403">
|
|
<bookmark_value>String service;JustifyLeft</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id51580135447561" localize="false">JustifyLeft</h2>
|
|
<paragraph role="paragraph" id="par_id911580135466348">Returns the input string left-justified.</paragraph>
|
|
<paragraph role="paragraph" id="par_id431612381917641">The leading white spaces are stripped and the remaining characters are completed to the right up to a specified total <literal>Length</literal> with the character <literal>Padding</literal>.</paragraph>
|
|
<h3 id="hd_id881580135478778" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id651580135503459">SF_String.JustifyLeft(InputStr As String[, Length As Long[, Padding As String]]) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id351580135513286" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id281580135523448"><emph>InputStr</emph>: The string to be left-justified. If empty, the method returns an empty string.</paragraph>
|
|
<paragraph role="paragraph" id="par_id431580135534910"><emph>Length</emph>: The length of the resulting string (default = the length of the input string).</paragraph>
|
|
<paragraph role="paragraph" id="par_id161612381664182">If the specified length is shorter than the left-justified input string, then the returned string is truncated.</paragraph>
|
|
<paragraph role="paragraph" id="par_id221580135568475"><emph>Padding</emph>: The single character to be used as padding (default = the Ascii space " ").</paragraph>
|
|
<h3 id="hd_id941580135580551" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id611580135592267">MsgBox SF_String.JustifyLeft("Title", Length := 10) ' "Title "</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id131580135610150">MsgBox SF_String.JustifyLeft(" ABCDE", Padding := "_") ' "ABCDEF____"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id441580135619176">MsgBox SF_String.JustifyLeft("A Long Title", Length := 5) ' "A Lon"</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="JustifyRight">
|
|
<comment> JustifyRight -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id401582205265380">
|
|
<bookmark_value>String service;JustifyRight</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id651580136079149" localize="false">JustifyRight</h2>
|
|
<paragraph role="paragraph" id="par_id821580136091225">Returns the input string right-justified.</paragraph>
|
|
<paragraph role="paragraph" id="par_id771612382000293">The leading white spaces are stripped and the remaining characters are completed to the left up to a specified total <literal>Length</literal> with the character <literal>Padding</literal>.</paragraph>
|
|
<h3 id="hd_id121580136100402" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id601580136111285">SF_String.JustifyRight(InputStr As String[, Length As Long[, Padding As String]]) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id941580136138725" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id201580136154170"><emph>InputStr</emph>: The string to be right-justified. If empty, the method returns an empty string.</paragraph>
|
|
<paragraph role="paragraph" id="par_id71580136164632"><emph>Length</emph>: The length of the resulting string (default = the length of the input string).</paragraph>
|
|
<paragraph role="paragraph" id="par_id191612381732163">If the specified length is shorter than the right-justified input string, then the returned string is truncated.</paragraph>
|
|
<paragraph role="paragraph" id="par_id751580136200680"><emph>Padding</emph>: The single character to be used as padding (default = the Ascii space " ").</paragraph>
|
|
<h3 id="hd_id891580136208498" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id791580136219992">MsgBox SF_String.JustifyRight("Title", Length := 10) ' " Title"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id751580136242414">MsgBox SF_String.JustifyRight(" ABCDE ", Padding := "_") ' "____ABCDEF"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id861580136253164">MsgBox SF_String.JustifyRight("A Long Title", Length := 5) ' "Title"</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="Quote">
|
|
<comment> Quote -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id241582205281048">
|
|
<bookmark_value>String service;Quote</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id741580136875363" localize="false">Quote</h2>
|
|
<paragraph role="paragraph" id="par_id251580136888958">Returns the input string enclosed in single or double quotes. Existing quotes are left unchanged, including leading and/or trailing quotes.</paragraph>
|
|
<h3 id="hd_id51580136908577" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id811580136919661">SF_String.Quote(InputStr As String, [QuoteChar As String]) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id571580136931161" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id811580136944674"><emph>InputStr</emph>: the string to quote.</paragraph>
|
|
<paragraph role="paragraph" id="par_id581599129397412" xml-lang="en-US"><emph>QuoteChar</emph> : Either the single (') or (default) double (") quote.</paragraph>
|
|
<h3 id="hd_id401580136956273" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id171580136967087">MsgBox SF_String.Quote("Text Value")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id331612442671018">' "Text Value"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id291580136977341">MsgBox SF_String.Quote("Book Title: ""The Arabian Nights""", "'")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id111612442632444">' 'Book Title: "The Arabian Nights"'</paragraph>
|
|
</bascode>
|
|
<tip id="par_id911612382537087">This method can be useful while preparing a string field to be stored in a csv-like file, which requires that text values be enclosed with single or double quotes.</tip>
|
|
</section>
|
|
|
|
<section id="ReplaceChar">
|
|
<comment> ReplaceChar -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id971582205313633">
|
|
<bookmark_value>String service;ReplaceChar</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id171580139110167" localize="false">ReplaceChar</h2>
|
|
<paragraph role="paragraph" id="par_id951580139124650">Replaces all occurrences of the characters specified in the <literal>Before</literal> parameter by the corresponding characters specified in <literal>After</literal>.</paragraph>
|
|
<paragraph role="paragraph" id="par_id1001612384040018">If the length of <literal>Before</literal> is greater than the length of <literal>After</literal>, the residual characters in <literal>Before</literal> are replaced by the last character in <literal>After</literal>.</paragraph>
|
|
<h3 id="hd_id541580139132412" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id521580139140846">SF_String.ReplaceChar(InputStr As String, Before As String, After As String) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id381580139149193" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id11580139160633"><emph>InputStr</emph>: The input string on which replacements will occur.</paragraph>
|
|
<paragraph role="paragraph" id="par_id111580139169795"><emph>Before</emph>: A string with the characters that will be searched in the input string for replacement.</paragraph>
|
|
<paragraph role="paragraph" id="par_id851580139182113"><emph>After</emph>: A string with the new characters that will replace those defined in <literal>Before</literal>.</paragraph>
|
|
<h3 id="hd_id921580139195974" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" id="bas_id921580139218457">' Replaces accented characters</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id281580139228929">MsgBox SF_String.ReplaceChar("Protégez votre vie privée", "àâãçèéêëîïôöûüýÿ", "aaaceeeeiioouuyy")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id361612384219658">' "Protegez votre vie privee"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id201580139288120">MsgBox SF_String.ReplaceChar("Protégez votre vie privée", "àâãçèéêëîïôöûüýÿ", "")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id401612443219105">' "Protgez votre vie prive"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id661580139301417">MsgBox SF_String.ReplaceChar("àâãçèéêëîïôöûüýÿ", "àâãçèéêëîïôöûüýÿ", "aaaceeeeiioouuyy")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id621612443248643">' "aaaceeeeiioouuyy"</paragraph>
|
|
</bascode>
|
|
<paragraph role="paragraph" id="par_id151612442904499">The <literal>SF_String</literal> service provides useful public constants for the Latin character sets, as shown in the example below:</paragraph>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id621580139272513">MsgBox SF_String.ReplaceChar("Protégez votre vie privée", SF_String.CHARSWITHACCENT, SF_String.CHARSWITHOUTACCENT)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id551612443170894">' "Protegez votre vie privee"</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="ReplaceRegex">
|
|
<comment> ReplaceRegex -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id541582205335970">
|
|
<bookmark_value>String service;ReplaceRegex</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id491580140260181" localize="false">ReplaceRegex</h2>
|
|
<paragraph role="paragraph" id="par_id671580140272818">Replaces all occurrences of a given regular expression by a new string.</paragraph>
|
|
<h3 id="hd_id681580140280567" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id191580140293750">SF_String.ReplaceRegex(InputStr As String, Regex As String, NewStr As String[, CaseSensitive As Boolean]) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id121580140302174" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id471580140311626"><emph>InputStr</emph>: The input string on which replacements will occur.</paragraph>
|
|
<paragraph role="paragraph" id="par_id651580140322666"><emph>Regex</emph>: The regular expression.</paragraph>
|
|
<paragraph role="paragraph" id="par_id891580140334754"><emph>NewStr</emph>: The replacing string.</paragraph>
|
|
<paragraph role="paragraph" id="par_id581580140345221"><emph>CaseSensitive</emph>: Default = <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id821580140356146" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id151580140386767">MsgBox SF_String.ReplaceRegex("Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "[a-z]", "x", CaseSensitive := True)</paragraph>
|
|
<paragraph role="bascode" id="bas_id961612384647003">' "Lxxxx xxxxx xxxxx xxx xxxx, xxxxxxxxxxx xxxxxxxxxx xxxx." (each lowercase letter is replaced by "x")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id11580140400163">MsgBox SF_String.ReplaceRegex("Lorem ipsum dolor sit amet, consectetur adipiscing elit.", "\b[a-z]+\b", "x", CaseSensitive := False)</paragraph>
|
|
<paragraph role="bascode" id="bas_id751612384623936">' "x x x x x, x x x." (each word is replaced by "x")</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="ReplaceStr">
|
|
<comment> ReplaceStr -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id751582205356816">
|
|
<bookmark_value>String service;ReplaceStr</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id701580146458127" localize="false">ReplaceStr</h2>
|
|
<paragraph role="paragraph" id="par_id51580146471894">Replaces in a string some or all occurrences of an array of strings by an array of new strings.</paragraph>
|
|
<h2 id="hd_id601580146478117" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h2>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id441580146486831">SF_String.ReplaceStr(InputStr As String, OldStr As Variant, NewStr As Variant[, Occurrences As Long[, CaseSensitive As Boolean]]) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id531580146494892" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id831580146504326"><emph>InputStr</emph>: The input string on which replacements will occur.</paragraph>
|
|
<paragraph role="paragraph" id="par_id411580146514927"><emph>OldStr</emph>: A single string or an array of strings. Zero-length strings are ignored.</paragraph>
|
|
<paragraph role="paragraph" id="par_id591580146532966"><emph>NewStr</emph>: The replacing string or the array of replacing strings.</paragraph>
|
|
<paragraph role="paragraph" id="par_id611612384873347">If <literal>OldStr</literal> is an array, each occurrence of any of the items in <literal>OldStr</literal> is replaced by <literal>NewStr</literal>.</paragraph>
|
|
<paragraph role="paragraph" id="par_id611612384880820">If <literal>OldStr</literal> and <literal>NewStr</literal> are arrays, replacements occur one by one up to the <literal>UBound(NewStr)</literal>.</paragraph>
|
|
<paragraph role="paragraph" id="par_id241612385058264">If <literal>OldStr</literal> has more entries than <literal>NewStr</literal>, then the residual elements in <literal>OldStr</literal> are replaced by the last element in <literal>NewStr</literal>.</paragraph>
|
|
<paragraph role="paragraph" id="par_id701580146547619"><emph>Occurrences</emph>: The maximum number of replacements. The default value is 0, meaning that all occurrences will be replaced.</paragraph>
|
|
<paragraph role="paragraph" id="par_id741612385380533">When <literal>OldStr</literal> is an array, the <literal>Occurrence</literal> parameter is computed separately for each item in the array.</paragraph>
|
|
<paragraph role="paragraph" id="par_id301580146556599"><emph>CaseSensitive</emph>: Default = <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id271580146564378" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id481580146574037">MsgBox SF_String.ReplaceStr("100 xxx 200 yyy", Array("xxx", "yyy"), Array("(1)", "(2)"), CaseSensitive := False)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id511612385563994">' "100 (1) 200 (2)"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id151580146611738">MsgBox SF_String.ReplaceStr("abCcdefghHij", Array("c", "h"), Array("Y", "Z"), CaseSensitive := False)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id491612385543543">' "abYYdefgZZij"</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="Represent">
|
|
<comment> Represent -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id151582205374090">
|
|
<bookmark_value>String service;Represent</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id581580147543150" localize="false">Represent</h2>
|
|
<paragraph role="paragraph" id="par_id901580147558931">Returns a string with a readable representation of the argument, truncated at a given length. This is useful mainly for debugging or logging purposes.</paragraph>
|
|
<paragraph role="paragraph" id="par_id11612386054691">If the <literal>AnyValue</literal> parameter is an object, it will be enclosed with square brackets "[" and "]".</paragraph>
|
|
<paragraph role="paragraph" id="par_id491612386081802">In strings, tabs and line breaks are replaced by \t, \n or \r.</paragraph>
|
|
<paragraph role="paragraph" id="par_id921612386089103">If the final length exceeds the <literal>MaxLength</literal> parameter, the latter part of the string is replaced by " ... (N)" where N is the total length of the original string before truncation.</paragraph>
|
|
<h3 id="hd_id911580147566891" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id791580147577630">SF_String.Represent(AnyValue As Variant[, MaxLength As Long]) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id451580147584386" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id91580147593626"><emph>AnyValue</emph>: The input value to be represented. It can be any value, such as a string, an array, a Basic object, a UNO object, etc.</paragraph>
|
|
<paragraph role="paragraph" id="par_id811580147609322"><emph>MaxLength</emph>: The maximum length of the resulting string. The default value is 0, meaning there is no limit to the length of the resulting representation.</paragraph>
|
|
<h3 id="hd_id571580147617381" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id931580147637178">MsgBox SF_String.Represent("this is a usual string") ' "this is a usual string"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id701580147646290">MsgBox SF_String.Represent("this is a usual string", 15) ' "this i ... (22)"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id1001580147656762">MsgBox SF_String.Represent("this is a" & Chr(10) & " 2-lines string") ' "this is a\n 2-lines string"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id661580147668170">MsgBox SF_String.Represent(Empty) ' "[EMPTY]"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id941580147685721">MsgBox SF_String.Represent(Null) ' "[NULL]"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id531580147702074">MsgBox SF_String.Represent(Pi) ' "3.142"</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id461580147719545">MsgBox SF_String.Represent(CreateUnoService("com.sun.star.util.PathSettings")) ' "[com.sun.star.comp.framework.PathSettings]"</paragraph>
|
|
</bascode>
|
|
<paragraph role="paragraph" id="par_id641612386659292">Note that the representation of data types such as Arrays and <literal>ScriptForge.Dictionary</literal> object instances include both the data type and their values:</paragraph>
|
|
<bascode>
|
|
<paragraph role="bascode" id="bas_id971612386906463">' An example with a Basic built-in Array</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id401580147734722">MsgBox SF_String.Represent(Array(1, 2, "Text" & Chr(9) & "here"))</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id311612386778843">' "[ARRAY] (0:2) (1, 2, Text\there)"</paragraph>
|
|
<paragraph role="bascode" id="bas_id401612386876329">' An example with a ScriptForge Array</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id621612386824731">Dim aValues as Variant</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id771612386825586">aValues = SF_Array.RangeInit(1, 5)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id841612386825825">MsgBox SF_String.Represent(aValues)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id121612386864144">' "[ARRAY] (0:4) (1.0, 2.0, 3.0, 4.0, 5.0)"</paragraph>
|
|
<paragraph role="bascode" id="bas_id551612386931680">' An example with a ScriptForge Dictionary</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id951580147750109">Dim myDict As Variant : myDict = CreateScriptService("Dictionary")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id701580147765158">myDict.Add("A", 1) : myDict.Add("B", 2)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id921580147782281">MsgBox SF_String.Represent(myDict)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id911612386800415">' "[Dictionary] ("A":1, "B":2)"</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="Reverse">
|
|
<comment> Reverse -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id111582205394632">
|
|
<bookmark_value>String service;Reverse</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id781580312915849" localize="false">Reverse</h2>
|
|
<paragraph role="paragraph" id="par_id411580312925741">Returns the input string in reversed order.</paragraph>
|
|
<paragraph role="paragraph" id="par_id141612387177873">This method is equivalent to the built-in <link href="text/sbasic/shared/03120412.xhp" name="StrReverse function"><literal>StrReverse</literal> Basic function</link>, however with better performance.</paragraph>
|
|
<note id="par_id961612387463144">To use the <literal>StrReverse</literal> function, the statement <literal>OpTion VBASupport 1</literal> must be present in the module.</note>
|
|
<h3 id="hd_id641580312936150" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id131580312945160">SF_String.Reverse(InputStr As String) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id331580312953405" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id241580312964497"><emph>InputStr</emph>: The string to be reversed.</paragraph>
|
|
<h3 id="hd_id401580312972520" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id671580313005541">MsgBox SF_String.Reverse("abcdefghij") ' "jihgfedcba"</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="SplitLines">
|
|
<comment> SplitLines -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id681582205412371">
|
|
<bookmark_value>String service;SplitLines</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id111580210751549" localize="false">SplitLines</h2>
|
|
<paragraph role="paragraph" id="par_id721580210762286">Returns a zero-based array of strings with the lines in the input string. Each item in the array is obtained by splitting the input string at newline characters.</paragraph>
|
|
<h3 id="hd_id321580210771879" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id471580210785190">SF_String.SplitLines(InputStr As String[, KeepBreaks As Long]) As Variant</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id571580210796332" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id481580210806878"><emph>InputStr</emph>: The string to be split.</paragraph>
|
|
<paragraph role="paragraph" id="par_id231580210820309"><emph>KeepBreaks</emph>: When <literal>True</literal>, line breaks are preserved in the output array (default = <literal>False</literal>).</paragraph>
|
|
<h3 id="hd_id571580210830125" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id301580210850100">Dim a as Variant</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id561580210860646">a = SF_String.SplitLines("Line1" & Chr(10) & "Line2" & Chr(13) & "Line3")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id661612387860556">' a = Array("Line1", "Line2", "Line3")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id791580210888116">a = SF_String.SplitLines("Line1" & Chr(10) & "Line2" & Chr(13) & "Line3" & Chr(10))</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id701612387837745">' a = Array("Line1", "Line2", "Line3", "")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id451580210958405">a = SF_String.SplitLines("Line1" & Chr(10) & "Line2" & Chr(13) & "Line3" & Chr(10), KeepBreaks := True)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id591612387824058">' a = Array("Line1\n", "Line2\r", "Line3\n", "")</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="SplitNotQuoted">
|
|
<comment> SplitNotQuoted -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id531582205451718">
|
|
<bookmark_value>String service;SplitNotQuoted</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id131580211748939" localize="false">SplitNotQuoted</h2>
|
|
<paragraph role="paragraph" id="par_id471580211762739">Splits a string into an array of elements using a specified delimiter.</paragraph>
|
|
<paragraph role="paragraph" id="par_id281612388034501">If a quoted substring contains a delimiter, it is ignored. This is useful when parsing CSV-like records that contain quoted strings.</paragraph>
|
|
<h3 id="hd_id291580211771851" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id121580211788563">SF_String.SplitNotQuoted(InputStr As String[, Delimiter As String], [Occurrences As Long], [QuoteChar As String]) As Variant</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id551580211795685" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id881580211809490"><emph>InputStr</emph>: The string to be split.</paragraph>
|
|
<paragraph role="paragraph" id="par_id811580211821162"><emph>Delimiter</emph>: A string of one or more characters that will be used as delimiter. The default delimiter is the space character.</paragraph>
|
|
<paragraph role="paragraph" id="par_id181580211833778"><emph>Occurrences</emph>: The maximum number of substrings to return. The default value is 0, meaning that there is no limit to the number of returned strings.</paragraph>
|
|
<paragraph role="paragraph" id="par_id421599123777334" xml-lang="en-US"><emph>QuoteChar</emph> : Either the single (') or double (") quote.</paragraph>
|
|
<h3 id="hd_id601580211844003" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id511580211876156">a = SF_String.SplitNotQuoted("abc def ghi")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id581580211857403">' a = Array("abc", "def", "ghi")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id711580211886107">a = SF_String.SplitNotQuoted("abc,""def,ghi""", ",")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id111580211865432">' a = Array("abc", """def,ghi""")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id101580211896350">a = SF_String.SplitNotQuoted("abc,""def\"",ghi""", ",")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id351612388312049"> ' a = Array("abc", """def\"",ghi""")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id591580211905379">a = SF_String.SplitNotQuoted("abc,""def\"",ghi"""",", ",")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id691580211914228">' a = Array("abc", """def\"",ghi""", "")</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="StartsWith">
|
|
<comment> StartsWith -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id521582205468821">
|
|
<bookmark_value>String service;StartsWith</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id121580212826111" localize="false">StartsWith</h2>
|
|
<paragraph role="paragraph" id="par_id771580212837884">Returns <literal>True</literal> if the first characters of a string are identical to a given substring.</paragraph>
|
|
<paragraph role="paragraph" id="par_id781612393174350">This method returns <literal>False</literal> if either the input string or the substring have a length = 0 or when the substring is longer than the input string.</paragraph>
|
|
<h3 id="hd_id21580212846559" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id751580212857168">SF_String.StartsWith(InputStr As String, Substring As String[, CaseSensitive As Boolean]) As Boolean</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id961580212866074" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id271580212876135"><emph>InputStr</emph>: The string to be tested.</paragraph>
|
|
<paragraph role="paragraph" id="par_id571580212889462"><emph>Substring</emph>: The substring to be searched at the start of <literal>InputStr</literal>.</paragraph>
|
|
<paragraph role="paragraph" id="par_id811580212900799"><emph>CaseSensitive</emph>: Default = <literal>False</literal>.</paragraph>
|
|
<h3 id="hd_id611580212907767" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id581580212931342">MsgBox SF_String.StartsWith("abcdefg", "ABC") 'True</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id491580212940539">MsgBox SF_String.StartsWith("abcdefg", "ABC", CaseSensitive := True) 'False</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="TrimExt">
|
|
<comment> TrimExt -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id461582205488207">
|
|
<bookmark_value>String service;TrimExt</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id191580295988498" localize="false">TrimExt</h2>
|
|
<paragraph role="paragraph" id="par_id911580295999690">Returns the input string without its leading and trailing whitespaces.</paragraph>
|
|
<h3 id="hd_id11580296008761" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id221580296022274">SF_String.TrimExt(InputStr As String) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id851580296031043" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id541580296044377"><emph>InputStr</emph>: The string to trimmed.</paragraph>
|
|
<h3 id="hd_id31580296069494" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id231580296079929">MsgBox SF_String.TrimExt(" Some text. ") ' "Some text."</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id871580296091857">MsgBox SF_String.TrimExt(" ABCDE" & Chr(9) & Chr(10) & Chr(13) & " ") ' "ABCDEF"</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="Unescape">
|
|
<comment> Unescape -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id651582205521725">
|
|
<bookmark_value>String service;Unescape</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id831580483080098" localize="false">Unescape</h2>
|
|
<paragraph role="paragraph" id="par_id61580483096936">Converts any escaped sequence (\\, \n, \r, \t) in the input string to their corresponding Ascii character.</paragraph>
|
|
<h3 id="hd_id1001580483305031" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id511580483105952">SF_String.Unescape(InputStr As String) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id371580483114862" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id971580483124743"><emph>InputStr</emph>: The string to be converted.</paragraph>
|
|
<h3 id="hd_id181580483136471" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id601580483196328">MsgBox SF_String.Unescape("abc\n\tdef\\n")</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id261580483205906">' "abc" & Chr(10) & Chr(9) & "def\n"</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="Unquote">
|
|
<comment> Unquote -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id471582205541341">
|
|
<bookmark_value>String service;Unquote</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id481580213622428" localize="false">Unquote</h2>
|
|
<paragraph role="paragraph" id="par_id831580213634029">Removes the single or double quotes enclosing the input string.</paragraph>
|
|
<paragraph role="paragraph" id="par_id811612393585600">This is useful when parsing CSV-like records that contain quoted strings.</paragraph>
|
|
<h3 id="hd_id831580213642790" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id791580213653076">SF_String.Unquote(InputStr As String, [QuoteChar As String]) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id621580213660309" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id761580213677493"><emph>InputStr</emph> : The string to unquote.</paragraph>
|
|
<paragraph role="paragraph" id="par_id211599129509890" xml-lang="en-US"><emph>QuoteChar</emph> : Either the single (') or double (") quote (default).</paragraph>
|
|
<h3 id="hd_id471580213684731" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id371580213703732">Dim s as String</paragraph>
|
|
<paragraph role="bascode" id="bas_id981580213799125">s = SF_String.Unquote("""Some text""") ' s = "Some text" (without enclosing quotes)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id51580213693694">' The string below does not have enclosing quotes, so it remains unchanged</paragraph>
|
|
<paragraph role="bascode" id="bas_id961612393917830">s = SF_String.Unquote("Some text") ' s = "Some text" (unchanged)</paragraph>
|
|
<paragraph role="bascode" id="bas_id461612394182689">' Quotes inside the string are not removed</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id961612394171186">s = SF_String.Unquote("The ""true"" meaning") ' s = "The ""true"" meaning"</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<section id="Wrap">
|
|
<comment> Wrap -------------------------------------------------------------------------------------------------------------------------- </comment>
|
|
<bookmark xml-lang="en-US" localize="false" branch="index" id="bm_id321585834468367">
|
|
<bookmark_value>String service;Wrap</bookmark_value>
|
|
</bookmark>
|
|
<h2 id="hd_id911585834468456" localize="false">Wrap</h2>
|
|
<paragraph role="paragraph" id="par_id871585834468102">Converts the input string into an array of substrings so that each item in the array has at most a given number of characters.</paragraph>
|
|
<paragraph role="paragraph" id="par_id21612394465120">In practice, this method returns a zero-based array of output lines, without newlines at the end, except for the pre-existing line-breaks.</paragraph>
|
|
<paragraph role="paragraph" id="par_id601612395193333">Tabs are expanded using the same procedure performed by the <link href="text/sbasic/shared/03/sf_string.xhp#ExpandTabs" name="ExpandTabs method">ExpandTabs</link> method.</paragraph>
|
|
<paragraph role="paragraph" id="par_id641612394826616"> Symbolic line breaks are replaced by their equivalent Ascii characters.</paragraph>
|
|
<paragraph role="paragraph" id="par_id361612394859733">If the wrapped output has no content, the returned array is empty.</paragraph>
|
|
<h3 id="hd_id631585834468272" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functsyntax"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id811585834468291">SF_String.Wrap(InputStr As String, [Width As Long], [TabSize As Integer]) As String</paragraph>
|
|
</bascode>
|
|
<h3 id="hd_id331585834468284" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functparameters"/></h3>
|
|
<paragraph role="paragraph" id="par_id251585834468498"><emph>InputStr</emph>: The string to wrap.</paragraph>
|
|
<paragraph role="paragraph" id="par_id351585834773177" xml-lang="en-US"><emph>Width</emph> : The maximum number of characters in each line (default = 70).</paragraph>
|
|
<paragraph role="paragraph" id="par_id741585834874500" xml-lang="en-US"><emph>TabSize</emph> : Before wrapping the text, the existing TAB <literal>Chr(9)</literal> characters are replaced with spaces. TabSize defines the TAB stops at TabSize + 1, 2 * TabSize + 1 , ... N * TabSize + 1 (default = 8).</paragraph>
|
|
<h3 id="hd_id111585834468398" localize="false"><embedvar href="text/sbasic/shared/00000003.xhp#functexample"/></h3>
|
|
<bascode>
|
|
<paragraph role="bascode" localize="false" id="bas_id461585835162853">a = "Neque porro quisquam est qui dolorem ipsum quia dolor sit amet, consectetur, adipisci velit..."</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id891585835170534">b = SF_String.Wrap(a, 20)</paragraph>
|
|
<paragraph role="bascode" localize="false" id="bas_id191585835179883">' Array("Neque porro ", "quisquam est qui ", "dolorem ipsum quia ", "dolor sit amet, ", "consectetur, ", "adipisci velit...")</paragraph>
|
|
</bascode>
|
|
</section>
|
|
|
|
<embed href="text/sbasic/shared/03/lib_ScriptForge.xhp#SF_InternalUse"/>
|
|
|
|
<section id="relatedtopics">
|
|
<embed href="text/sbasic/shared/03/sf_array.xhp#ArrayService"/>
|
|
<paragraph role="paragraph" id="par_id271612398715438"><link href="text/sbasic/shared/03120202.xhp" name="String function">String built-in function</link></paragraph>
|
|
</section>
|
|
</body>
|
|
</helpdocument>
|