<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic 回复： How can count the number of consecutive Spaces at the beginning of each line? in Discussions</title>
    <link>https://community.jmp.com/t5/Discussions/How-can-count-the-number-of-consecutive-Spaces-at-the-beginning/m-p/752788#M93438</link>
    <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;          Scripting Guide
              Introduction to Writing JSL Scripts
                  What JSL Can Do for You
                  Help with Learning JSL
                      The Scripting Index
                      Let JMP Teach You JSL
                  JSL Terminology
                  Basic JSL Syntax
                  Scripting Guide Conventions
              Get Started
                  Capture a Script for an Analysis Report
                  Capture a Script for a Data Table
                  Capture a Script to Import a File
                  Glue Scripts Together&lt;/CODE&gt;&lt;/PRE&gt;</description>
    <pubDate>Wed, 08 May 2024 02:54:00 GMT</pubDate>
    <dc:creator>lala</dc:creator>
    <dc:date>2024-05-08T02:54:00Z</dc:date>
    <item>
      <title>How can count the number of consecutive Spaces at the beginning of each line?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-count-the-number-of-consecutive-Spaces-at-the-beginning/m-p/752785#M93437</link>
      <description>&lt;P&gt;It can be implemented with a formula or a regex&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="2024-05-08_10-35-26.png" style="width: 601px;"&gt;&lt;img src="https://community.jmp.com/t5/image/serverpage/image-id/64000i0DB60FC4880999D4/image-size/large?v=v2&amp;amp;px=999" role="button" title="2024-05-08_10-35-26.png" alt="2024-05-08_10-35-26.png" /&gt;&lt;/span&gt;&lt;BR /&gt;I only know how to use this formula, but it's definitely not right.I don't want to do it in a circular way.&lt;/P&gt;&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;Length(txt)-Length(Substitute(txt, " ", ""))&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;Thanks!&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 02:53:24 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-count-the-number-of-consecutive-Spaces-at-the-beginning/m-p/752785#M93437</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-08T02:53:24Z</dc:date>
    </item>
    <item>
      <title>回复： How can count the number of consecutive Spaces at the beginning of each line?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-count-the-number-of-consecutive-Spaces-at-the-beginning/m-p/752788#M93438</link>
      <description>&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;          Scripting Guide
              Introduction to Writing JSL Scripts
                  What JSL Can Do for You
                  Help with Learning JSL
                      The Scripting Index
                      Let JMP Teach You JSL
                  JSL Terminology
                  Basic JSL Syntax
                  Scripting Guide Conventions
              Get Started
                  Capture a Script for an Analysis Report
                  Capture a Script for a Data Table
                  Capture a Script to Import a File
                  Glue Scripts Together&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 May 2024 02:54:00 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-count-the-number-of-consecutive-Spaces-at-the-beginning/m-p/752788#M93438</guid>
      <dc:creator>lala</dc:creator>
      <dc:date>2024-05-08T02:54:00Z</dc:date>
    </item>
    <item>
      <title>Re: How can count the number of consecutive Spaces at the beginning of each line?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-count-the-number-of-consecutive-Spaces-at-the-beginning/m-p/752799#M93439</link>
      <description>&lt;P&gt;This is similar to your code, but I would suspect it will more correct, because your code will substitute the blank characters within the text.&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;txt = "   Scripting Guide";
numLeadingBlanks = Length( txt ) - Length( Trim( txt ) );&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;It can also return an error if there are trailing blanks.&lt;/P&gt;
&lt;P&gt;This should correct for that issue&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;txt = "   Scripting Guide   ";
numLeadingBlanks = Contains( txt, Substr( Trim( txt ), 1, 1 ) ) - 1;&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Wed, 08 May 2024 03:49:16 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-count-the-number-of-consecutive-Spaces-at-the-beginning/m-p/752799#M93439</guid>
      <dc:creator>txnelson</dc:creator>
      <dc:date>2024-05-08T03:49:16Z</dc:date>
    </item>
    <item>
      <title>Re: How can count the number of consecutive Spaces at the beginning of each line?</title>
      <link>https://community.jmp.com/t5/Discussions/How-can-count-the-number-of-consecutive-Spaces-at-the-beginning/m-p/752942#M93472</link>
      <description>&lt;P&gt;You can also provide Trim() with optional argument &lt;EM&gt;left&lt;/EM&gt; (it defaults to both) so it trims only start of the string&lt;/P&gt;
&lt;PRE&gt;&lt;CODE class=" language-jsl"&gt;txt = "   Scripting Guide   ";
numLeadingBlanks = Length(txt) - Length(Trim Whitespace(txt, left));&lt;/CODE&gt;&lt;/PRE&gt;
&lt;P&gt;(Trim Whitespace() should just be an alias for same function but it is more clear so I tend to use it)&lt;/P&gt;</description>
      <pubDate>Wed, 08 May 2024 14:45:47 GMT</pubDate>
      <guid>https://community.jmp.com/t5/Discussions/How-can-count-the-number-of-consecutive-Spaces-at-the-beginning/m-p/752942#M93472</guid>
      <dc:creator>jthi</dc:creator>
      <dc:date>2024-05-08T14:45:47Z</dc:date>
    </item>
  </channel>
</rss>

