<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=6222&amp;type=atom" />
	<updated>2015-02-12T13:59:15Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=6222</id>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=91468#p91468" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>var str = &quot;Мама    мыла   раму.  Рабы   не  мы,   мы   не    рабы.&quot;;
var re = / +/;
var strArray = str.split(re);
WScript.Echo(&quot;Array=&quot;+strArray);</code></pre></div>]]></content>
			<author>
				<name><![CDATA[olmovc2]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=32874</uri>
			</author>
			<updated>2015-02-12T13:59:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=91468#p91468</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=86379#p86379" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>alexii пишет:</cite><blockquote><p><strong>JSman</strong>, ну, это ежели судить по буковкам, тогда — да. А я так понял, что речь изначально шла сугубо про ориентировку по пробельным символам, то есть, включая все прочие символы в состав слов.</p></blockquote></div><p>Как вариант </p><div class="codebox"><pre><code>[^\s]+</code></pre></div><p> ?</p><div class="codebox"><pre><code>
Option Explicit

Dim oCol
Dim e
Dim sTmp

With CreateObject(&quot;VBScript.RegExp&quot;)
    .Global = True
    .Pattern = &quot;[^\s]+&quot;
    Set oCol = .Execute(&quot;Мама    мыла   раму.  Рабы   не  мы,   мы   не    рабы.&quot;)
End With

MsgBox &quot;Найдено элементов: &quot; &amp; oCol.Count

if oCol.Count &lt; 0 Then WScript.Quit
For Each e in oCol
    sTmp = sTmp &amp; &quot;[&quot; &amp; e &amp; &quot;]&quot;
Next
MsgBox sTmp
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[Xameleon]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=8836</uri>
			</author>
			<updated>2014-09-10T06:20:12Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=86379#p86379</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=86378#p86378" />
			<content type="html"><![CDATA[<p><strong>JSman</strong>, ну, это ежели судить по буковкам, тогда — да. А я так понял, что речь изначально шла сугубо про ориентировку по пробельным символам, то есть, включая все прочие символы в состав слов.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-09-10T06:12:16Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=86378#p86378</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=86374#p86374" />
			<content type="html"><![CDATA[<p><strong>JSman</strong>, ещё &quot;ёЁ&quot;. На всякий случай <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p>]]></content>
			<author>
				<name><![CDATA[Serge Yolkin]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27503</uri>
			</author>
			<updated>2014-09-09T18:56:11Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=86374#p86374</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=86373#p86373" />
			<content type="html"><![CDATA[<p><strong>alexii</strong>, [А-Яа-яA-Za-z]+, Execute.</p>]]></content>
			<author>
				<name><![CDATA[JSmаn]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24434</uri>
			</author>
			<updated>2014-09-09T17:56:05Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=86373#p86373</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=86362#p86362" />
			<content type="html"><![CDATA[<p>Выше уже <a href="http://forum.script-coding.com/viewtopic.php?pid=51549#p51549">было</a> сказано:<br /></p><div class="codebox"><pre><code>Dim strWords

strWords = &quot;Мама     мыла   раму.  Рабы   не  мы,   мы   не    рабы.&quot;

With WScript.CreateObject(&quot;VBScript.RegExp&quot;)
    .Pattern = &quot; {2,}&quot;
    .Global = True
    
    If .Test(strWords) Then
        strWords = .Replace(strWords, &quot; &quot;)
    End If
End With
</code></pre></div><p>А затем смело делайте «Split(strWords, &quot; &quot;)», ежели кому потребно.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-09-08T16:32:59Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=86362#p86362</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=86358#p86358" />
			<content type="html"><![CDATA[<div class="quotebox"><cite>MikeSh пишет:</cite><blockquote><p>While ...<br />WEnd</p></blockquote></div><p>Замену многих пробелов на один можно сделать без цикла (правда, нужно найти символ, который не используется в тексте):<br /></p><div class="codebox"><pre><code>blabla = Chr(1)        &#039; символ, которого точно нет в тексте
Msg = Replace(Msg, &quot;  &quot;, &quot; &quot; + blabla) 
Msg = Replace(Msg, blabla + &quot; &quot;, &quot;&quot;) 
Msg = Replace(Msg, blabla, &quot;&quot;) </code></pre></div>]]></content>
			<author>
				<name><![CDATA[nicksh]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=30796</uri>
			</author>
			<updated>2014-09-08T14:01:29Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=86358#p86358</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=86258#p86258" />
			<content type="html"><![CDATA[<p>Я обычно так делаю<br /></p><div class="codebox"><pre><code>Msg = &quot;строка   с      пробелами    1&quot;

While Instr(Msg, &quot;  &quot;) &gt; 0 &#039;В кавычках 2 пробела

  Msg = Replace(Msg, &quot;  &quot;, &quot; &quot;) &#039;2 пробела меняется на 1

WEnd
SplitMsg = Split(Msg, &quot; &quot;)
</code></pre></div>]]></content>
			<author>
				<name><![CDATA[MikeSh]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=24507</uri>
			</author>
			<updated>2014-09-02T19:24:57Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=86258#p86258</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=86257#p86257" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>sString = &quot;some     text&quot;
Do
    lTmp = Len(sString)
    sString = Replace(sString, &quot;  &quot;, &quot; &quot;)
Loop Until Len(sString) = lTmp
aMyArray = Split(sString, &quot; &quot;, -1, 1)</code></pre></div>]]></content>
			<author>
				<name><![CDATA[omegastripes]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=29228</uri>
			</author>
			<updated>2014-09-02T17:40:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=86257#p86257</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=86243#p86243" />
			<content type="html"><![CDATA[<p><strong>al_chel</strong>, это явно не VBScript <img src="//forum.script-coding.com/img/smilies/wink.png" width="15" height="15" />.</p>]]></content>
			<author>
				<name><![CDATA[alexii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=1844</uri>
			</author>
			<updated>2014-09-02T13:21:09Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=86243#p86243</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=86241#p86241" />
			<content type="html"><![CDATA[<p>String[] array = s.split(&quot;\\p{Space}++&quot;);</p>]]></content>
			<author>
				<name><![CDATA[al_chel]]></name>
			</author>
			<updated>2014-09-02T12:02:04Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=86241#p86241</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51551#p51551" />
			<content type="html"><![CDATA[<p>Сейчас только сообразил, что при преобразовании строки в массив без предварительной замены последовательностей пробелов на одиночные пробелы функция <span style="color: blue">Trim()</span> не понадобится.<br />Выражение <strong><span style="color: blue">Split(string, &quot; &quot;, -1, 1)</span></strong> вернёт массив, где каждому &quot;лишнему&quot; пробелу исходной строки будет соответствовать элемент, значением которого является строка нулевой длины. Следовательно, потребуется либо &quot;уплотнить&quot; массив, избавившись от этих элементов, либо просто проверять длину (в символах) каждого элемента перед дальнейшей обработкой.</p>]]></content>
			<author>
				<name><![CDATA[Dmitrii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=13351</uri>
			</author>
			<updated>2011-09-16T10:30:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51551#p51551</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51550#p51550" />
			<content type="html"><![CDATA[<p>Спасибо</p>]]></content>
			<author>
				<name><![CDATA[Олег]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27198</uri>
			</author>
			<updated>2011-09-16T07:41:50Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51550#p51550</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51549#p51549" />
			<content type="html"><![CDATA[<p>Вариант 1. Каждый элемент массива обрабатывайте функцией <strong><span style="color: blue">Trim()</span></strong>.<br />Вариант 2. С помощью регулярных выражений замените последовательности пробелов на одиночные пробелы, после чего уже преобразуйте строку в массив.</p>]]></content>
			<author>
				<name><![CDATA[Dmitrii]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=13351</uri>
			</author>
			<updated>2011-09-16T06:36:42Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51549#p51549</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: VBS: Как разобрать строку, где слова разделены НЕСКОЛЬКИМИ пробелами]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=51548#p51548" />
			<content type="html"><![CDATA[<p>Если бы количество пробелов было фиксированным, то тоже понятно: MyArray = Split(string, &quot;&nbsp; &nbsp; &nbsp; &quot;, -1, 1).</p>]]></content>
			<author>
				<name><![CDATA[Олег]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27198</uri>
			</author>
			<updated>2011-09-16T05:25:17Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=51548#p51548</id>
		</entry>
</feed>
