String methods syntax: Difference between revisions
m (Automatically generated page update) |
m (Automatically generated page update) |
||
Line 28: | Line 28: | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[HexToString (String function)|HexToString]]</span></p> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[HexToString (String function)|HexToString]]</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Inflate (String function)|Inflate]]</span></p> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Inflate (String function)|Inflate]]</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Insert (String function)|Insert]]</span><span class="literal">(</span> <span class="term" title="String"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Insert (String function)|Insert]]</span><span class="literal">(</span> <span class="term" title="String">insertedString</span><span class="comma">,</span> <span class="term" title="Number">position</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%boolean</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[IsOneOf (String function)|IsOneOf]]</span><span class="literal">(</span> <span class="term" title="String">list</span><span class="literal">)</span></p> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%boolean</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[IsOneOf (String function)|IsOneOf]]</span><span class="literal">(</span> <span class="term" title="String">list</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Left (String function)|Left]]</span><span class="literal">(</span> <span class="term" title="Number">length</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="C">Pad=</span> <span class="term" title="C">c</span><span class="squareb">]</span><span class="literal">)</span></p> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Left (String function)|Left]]</span><span class="literal">(</span> <span class="term" title="Number">length</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="C">Pad=</span> <span class="term" title="C">c</span><span class="squareb">]</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%length</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Length (String function)|Length]]</span></p> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%length</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Length (String function)|Length]]</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[MD5digest (String function)|MD5digest]]</span></p> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[MD5digest (String function)|MD5digest]]</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%sl</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[ParseLines (String function)|ParseLines]]</span><span class="squareb">[</span><span class="literal">(</span> <span class="squareb">[</span><span class="term" title="String">delims</span><span class="squareb">]</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="Boolean">StripTrailingNull=</span> <span class="term" title="Boolean">boolean</span><span class="squareb">]</span><span class="literal">)</span><span class="squareb">]</span></p> | |||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%position</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[PositionIn (String function)|PositionIn]]</span><span class="literal">(</span> <span class="term" title="String">haystack</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="Number">Start=</span> <span class="term" title="Number">number</span><span class="squareb">]</span><span class="literal">)</span></p> | |||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%position</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[PositionOf (String function)|PositionOf]]</span><span class="literal">(</span> <span class="term" title="String">needle</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="Number">Start=</span> <span class="term" title="Number">number</span><span class="squareb">]</span><span class="literal">)</span></p> | |||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%sl</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[ParseLines (String function)|ParseLines]]</span><span class="squareb">[</span><span class="literal">(</span> <span class="squareb">[</span><span class="term" title="String"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[RC4decrypt (String function)|RC4decrypt]]</span><span class="literal">(</span> <span class="term" title="String">key</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%position</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[PositionIn (String function)|PositionIn]]</span><span class="literal">(</span> <span class="term" title="String"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[RC4encrypt (String function)|RC4encrypt]]</span><span class="literal">(</span> <span class="term" title="String">key</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%position</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[PositionOf (String function)|PositionOf]]</span><span class="literal">(</span> <span class="term" title="String"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%number</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[RegexMatch (String function)|RegexMatch]]</span><span class="literal">(</span> <span class="term" title="String">regex</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="String">Options=</span> <span class="term" title="String">string</span><span class="squareb">]</span><span class="comma">,</span> - | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[RC4decrypt (String function)|RC4decrypt]]</span><span class="literal">(</span> <span class="term" title="String"> | |||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[RC4encrypt (String function)|RC4encrypt]]</span><span class="literal">(</span> <span class="term" title="String"> | |||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%number</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[RegexMatch (String function)|RegexMatch]]</span><span class="literal">(</span> <span class="term" title="String"> | |||
<span class="squareb">[</span><span class="literal" title="Stringlist">CaptureList=</span> <span class="term" title="Stringlist">stringlist</span><span class="squareb">]</span><span class="literal">)</span></p> | <span class="squareb">[</span><span class="literal" title="Stringlist">CaptureList=</span> <span class="term" title="Stringlist">stringlist</span><span class="squareb">]</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[RegexReplace (String function)|RegexReplace]]</span><span class="literal">(</span> <span class="term" title="String"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[RegexReplace (String function)|RegexReplace]]</span><span class="literal">(</span> <span class="term" title="String">regex</span><span class="comma">,</span> <span class="term" title="String">replacement</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="String">Options=</span> <span class="term" title="String">string</span><span class="squareb">]</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%sl</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[RegexSplit (String function)|RegexSplit]]</span><span class="literal">(</span> <span class="term" title="String"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%sl</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[RegexSplit (String function)|RegexSplit]]</span><span class="literal">(</span> <span class="term" title="String">regex</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="String">Options=</span> <span class="term" title="String">string</span><span class="squareb">]</span><span class="comma">,</span> - | ||
<span class="squareb">[</span><span class="literal" title="RegexSplitOutputOptions">Add=</span> <span class="term" title="RegexSplitOutputOptions">regexSplitOutputOptions</span><span class="squareb">]</span><span class="literal">)</span></p> | <span class="squareb">[</span><span class="literal" title="RegexSplitOutputOptions">Add=</span> <span class="term" title="RegexSplitOutputOptions">regexSplitOutputOptions</span><span class="squareb">]</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Remove (String function)|Remove]]</span><span class="literal">(</span> <span class="term" title="String"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Remove (String function)|Remove]]</span><span class="literal">(</span> <span class="term" title="String">substring</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="Number">Count=</span> <span class="term" title="Number">number</span><span class="squareb">]</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Replace (String function)|Replace]]</span><span class="literal">(</span> <span class="term" title="String"> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Replace (String function)|Replace]]</span><span class="literal">(</span> <span class="term" title="String">substring</span><span class="comma">,</span> <span class="term" title="String">replacement</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="Number">Count=</span> <span class="term" title="Number">number</span><span class="squareb">]</span><span class="literal">)</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Reverse (String function)|Reverse]]</span></p> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Reverse (String function)|Reverse]]</span></p> | ||
<p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Right (String function)|Right]]</span><span class="literal">(</span> <span class="term" title="Number">length</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="C">Pad=</span> <span class="term" title="C">c</span><span class="squareb">]</span><span class="literal">)</span></p> | <p class="syntax" style="margin-bottom:0px; border-bottom:1px solid; border-left:1px solid; border-right:1px solid; border-top: none; margin-top:0px;"><span class="term">%outString</span><span class="literal"> =</span> <span class="term">string</span><span class="literal">:[[Right (String function)|Right]]</span><span class="literal">(</span> <span class="term" title="Number">length</span><span class="comma">,</span> <span class="squareb">[</span><span class="literal" title="C">Pad=</span> <span class="term" title="C">c</span><span class="squareb">]</span><span class="literal">)</span></p> |
Revision as of 23:00, 2 February 2011
The syntax for each of the String class methods is shown below.
Square brackets indicate optional elements of the method invocation. See also the notation conventions for methods and the List of String methods.
%outString = string:AsciiToEbcdic[( [CharacterEncode= boolean])]
%outString = string:Base64ToString
%number = string:BinaryToFloat
%number = string:BinaryToInteger[( [Signed= boolean])]
%result = string:BitAndString( andBits, [Pad= c])
%result = string:BitOffString( offBits, [Pad= c])
%result = string:BitOnString( onBits, [Pad= c])
%result = string:BitOrString( orBits, [Pad= c])
%result = string:BitXorString( xorBits, [Pad= c])
%outString = string:Center( length, [Pad= c], [OffsetLeft= boolean])
%outString = string:Centre( length, [Pad= c], [OffsetLeft= boolean])
%outString = string:Char( position)
%outString = string:Deflate[( [FixedCode= boolean], [LazyMatch= boolean], - [MaxChain= number])]
%outString = string:EbcdicToAscii[( [CharacterDecode= boolean])]
%unicode = string:EbcdicToUnicode[( [CharacterDecode= boolean], - [Untranslatable= unicode])]
%outString = string:Gunzip
%number = string:GunzipDatetimeNS
%outString = string:GunzipFilename
%outString = string:Gzip[( [FixedCode= boolean], [LazyMatch= boolean], - [MaxChain= number], [Filename= string], - [LastModified= number])]
%number = string:HexToInteger[( [Signed= boolean])]
%outString = string:HexToString
%outString = string:Inflate
%outString = string:Insert( insertedString, position)
%boolean = string:IsOneOf( list)
%outString = string:Left( length, [Pad= c])
%length = string:Length
%outString = string:MD5digest
%sl = string:ParseLines[( [delims], [StripTrailingNull= boolean])]
%position = string:PositionIn( haystack, [Start= number])
%position = string:PositionOf( needle, [Start= number])
%outString = string:RC4decrypt( key)
%outString = string:RC4encrypt( key)
%number = string:RegexMatch( regex, [Options= string], - [CaptureList= stringlist])
%outString = string:RegexReplace( regex, replacement, [Options= string])
%sl = string:RegexSplit( regex, [Options= string], - [Add= regexSplitOutputOptions])
%outString = string:Remove( substring, [Count= number])
%outString = string:Replace( substring, replacement, [Count= number])
%outString = string:Reverse
%outString = string:Right( length, [Pad= c])
%outString = string:SHAdigest
%outString = string:StringToBase64
%days = string:StringToDays( string, [centSpan])
%outString = string:StringToHex
%milliseconds = string:StringToMilliseconds( string, [centSpan])
%seconds = string:StringToSeconds( string, [centSpan])
%outString = string:Substring( position, [length], [Pad= c])
%outString = string:ToLower
%outString = string:ToString
%outString = string:ToUpper
%outString = string:Translate( characterMap)
%unicode = string:U
%outString = string:Unspace[( [Spaces= string], [Leading= boolean], - [Trailing= boolean], [Compress= boolean])]
%unicode = string:Utf16ToUnicode[( [AllowUntranslatable= boolean], - [Bom= utf16BOM])]
%unicode = string:Utf8ToUnicode[( [AllowUntranslatable= boolean])]
%outString = string:X
%outString = string:Zip[( [FixedCode= boolean], [LazyMatch= boolean], - [MaxChain= number], [Filename= string], - [LastModified= number])]
%stringTokenizer = string:stringTokenizer[( [TokenChars= string], - [Spaces= string], - [Quotes= string], - [Separators= string])]