turtlestitch/libraries/strings.xml

1 wiersz
7.8 KiB
XML
Czysty Zwykły widok Historia

<blocks app="Snap! 6, https://snap.berkeley.edu" version="1"><block-definition s="multiline %&apos;text&apos;" type="reporter" category="operators"><header></header><code></code><translations>pt:o texto multilinha _&#xD;</translations><inputs><input type="%mlt"></input></inputs><script><block s="doReport"><block var="text"/></block></script></block-definition><block-definition s="substring of %&apos;string&apos; before %&apos;marker&apos;" type="reporter" category="operators"><comment x="0" y="0" w="175.33333333333334" collapsed="false">Reports the part of the first string up to the first instance of the second string inside it. If the second string isn&apos;t found, reports the entire first string.</comment><header></header><code></code><translations>pt:o texto de _ antes de _&#xD;</translations><inputs><input type="%txt"></input><input type="%txt"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>string</l><l>marker</l></list><l>var world=this.parentThatIsA(IDE_Morph);&#xD;if (!("stringLibCaseIndependentComparison" in world)) {&#xD; world["stringLibCaseIndependentComparison"] = true;&#xD;};&#xD;if (world["stringLibCaseIndependentComparison"]) {&#xD; var index=string.toLocaleLowerCase().indexOf(marker.toLocaleLowerCase());&#xD; if (index&lt;0) {return string};&#xD; return string.slice(0,index);&#xD;} else {&#xD; var index=string.indexOf(marker);&#xD; if (index&lt;0) {return string};&#xD; return string.slice(0,index);&#xD;}</l></block><list><block var="string"/><block var="marker"/></list></block></block></script></block-definition><block-definition s="substring of %&apos;string&apos; after %&apos;marker&apos;" type="reporter" category="operators"><comment x="0" y="0" w="203.33333333333334" collapsed="false">Reports the portion of the first input string starting after the first occurrence of the second string. If the second string isn&apos;t found in the first string, reports an empty string.</comment><header></header><code></code><translations>pt:o texto de _ depois de _&#xD;</translations><inputs><input type="%txt"></input><input type="%txt"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>string</l><l>marker</l><l>markerlength</l></list><l>var world=this.parentThatIsA(IDE_Morph);&#xD;if (!("stringLibCaseIndependentComparison" in world)) {&#xD; world["stringLibCaseIndependentComparison"] = true;&#xD;};&#xD;if (world["stringLibCaseIndependentComparison"]) {&#xD; var index=string.toLocaleLowerCase().indexOf(marker.toLocaleLowerCase());&#xD; if (index&lt;0) {return ""};&#xD; return string.slice(index+markerlength);&#xD;} else {&#xD; var index=string.indexOf(marker);&#xD; if (index&lt;0) {return ""};&#xD; return string.slice(index+markerlength);&#xD;}</l></block><list><block var="string"/><block var="marker"/><block s="reportStringSize"><block var="marker"/></block></list></block></block></script></block-definition><block-definition s="position of %&apos;small&apos; in %&apos;large&apos;" type="reporter" category="operators"><comment x="0" y="0" w="294" collapsed="false">Reports the character position (starting from 1) of the beginning of the first input string inside the second input string.&#xD;If it&apos;s not found, reports 0.</comment><header></header><code></code><translations>pt:a posição de _ em _&#xD;</translations><inputs><input type="%s"></input><input type="%txt"></input></inputs><script><block s="doReport"><block s="evaluate"><block s="reportJSFunction"><list><l>sub</l><l>sup</l></list><l>var world=this.parentThatIsA(IDE_Morph);&#xD;if (!("stringLibCaseIndependentComparison" in world)) {&#xD; world["stringLibCaseIndependentComparison"] = true;&#xD;};&#xD;if (world["stringLibCaseIndependentComparison"]) {&#xD; return 1+sup.toLocaleLowerCase().indexOf(sub.toLocaleLowerCase());&#xD;} else {&#xD; return 1+sup.indexOf(sub);&#xD;}</l></block><list><block var="small"/><block var="large"/></list></block></block></script></block-definition><block-definition s="