<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
	<title type="html"><![CDATA[Серый форум &mdash; AHK: StringSplit и 4-е подряд пробела.]]></title>
	<link rel="self" href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=8307&amp;type=atom" />
	<updated>2013-05-30T11:13:15Z</updated>
	<generator>PunBB</generator>
	<id>https://forum.script-coding.com/viewtopic.php?id=8307</id>
		<entry>
			<title type="html"><![CDATA[Re: AHK: StringSplit и 4-е подряд пробела.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72565#p72565" />
			<content type="html"><![CDATA[<p>Что думаете по счёт такого варианта?:</p><div class="codebox"><pre><code>
text =
(
sec&quot;    &quot;mA&quot;    &quot;mV
3,2452587890625    -0,00311479461379349    0,854992806911469
3,29225610351563    -0,00306393066421151    0,884990870952606
)


RegExSplit( text, &quot;MyArray&quot;, &quot;    |\R&quot;, &quot;&quot;&quot;&quot;)
loop % MyArray0
    MsgBox,, MyArray%A_Index%, % MyArray%A_Index%
Listvars

RegExSplit( Str, NameArr, Delimiter, OmmitChr := &quot;&quot;)    {
    Local Pos := 1, PrPos := &quot;&quot;
    While (PrPos &lt;&gt; Pos) 
        PrPos := Pos, %NameArr%0 := A_Index - 1
        , Pos := RegExMatch(Str, &quot;S`a)(?&lt;&quot; A_Index &quot;&gt;.*?)(?:&quot; Delimiter &quot;|$)&quot;, %NameArr%, Pos) + StrLen(%NameArr%) 
        , %NameArr%%A_Index% := Trim(%NameArr%%A_Index%, OmmitChr)
}
return
</code></pre></div><p>Тут нет варианта того, что в тексте окажется символ разделителя для StringSplit.<br />Результат эдинтичен применению StringSplit.</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-05-30T11:13:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72565#p72565</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: StringSplit и 4-е подряд пробела.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72157#p72157" />
			<content type="html"><![CDATA[<p>Правильно ли я понял что &quot;Chr(9733)&quot; это извлечение символа которого скорее всего небудет в исходной строке, и это:<br /></p><div class="codebox"><pre><code>
text =
(
sec&quot;    &quot;mA&quot;    &quot;mV
3,2452587890625    -0,00311479461379349    0,854992806911469
3,29225610351563    -0,00306393066421151    0,884990870952606
)

text := RegExReplace(text, &quot;`a)(    |\R)&quot;, Chr(29733))

StringSplit StringArr, text, % Chr(29733)
Listvars
Pause
</code></pre></div><p>также верно, как и код выше, и как это:<br /></p><div class="codebox"><pre><code>
text := RegExReplace(text, &quot;`a)(    |\R)&quot;, &quot;¶&quot;)

StringSplit StringArr, text, ¶
</code></pre></div><p>?</p>]]></content>
			<author>
				<name><![CDATA[serzh82saratov]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=27879</uri>
			</author>
			<updated>2013-05-16T10:56:22Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72157#p72157</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: StringSplit и 4-е подряд пробела.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72118#p72118" />
			<content type="html"><![CDATA[<p>И еще раз спасибо.</p><p>added: гдето на порядок быстрее..или больше.</p>]]></content>
			<author>
				<name><![CDATA[Mikki]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5905</uri>
			</author>
			<updated>2013-05-14T16:27:20Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72118#p72118</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: StringSplit и 4-е подряд пробела.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72117#p72117" />
			<content type="html"><![CDATA[<p>Согласно рекомендациям из справки.<br /></p><div class="codebox"><pre><code>text =
(
sec&quot;    &quot;mA&quot;    &quot;mV
3,2452587890625    -0,00311479461379349    0,854992806911469
3,29225610351563    -0,00306393066421151    0,884990870952606
)

StringReplace text, text, % &quot;    &quot;, % Chr(9733), 1
StringReplace text, text, `r`n, % Chr(9733), 1
StringReplace text, text, `n, % Chr(9733), 1

StringSplit StringArr, text, % Chr(9733)
Listvars
Pause</code></pre></div>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2013-05-14T16:15:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72117#p72117</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: StringSplit и 4-е подряд пробела.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72110#p72110" />
			<content type="html"><![CDATA[<p>ИЗвиняюсь, у меня 1.1.08. Спасибо. Сейчас обновлюсь.</p>]]></content>
			<author>
				<name><![CDATA[Mikki]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5905</uri>
			</author>
			<updated>2013-05-14T12:34:58Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72110#p72110</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: StringSplit и 4-е подряд пробела.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72109#p72109" />
			<content type="html"><![CDATA[<p>В ByRef ommit := &quot;&quot; не нужно убрать двоеточие. с ним работает аж с ноября 2012.<br /></p><div class="quotebox"><blockquote><p>1.1.09.00 - November 7, 2012<br />Allow optional parameters to be declared with := instead of =, for consistency with variable declarations and expressions.</p></blockquote></div>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2013-05-14T12:28:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72109#p72109</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: StringSplit и 4-е подряд пробела.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72108#p72108" />
			<content type="html"><![CDATA[<p>Спасибо большое.</p><p>(в ByRef ommit := &quot;&quot; надо убрать двоеточие. с ним не работает)</p>]]></content>
			<author>
				<name><![CDATA[Mikki]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5905</uri>
			</author>
			<updated>2013-05-14T12:26:54Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72108#p72108</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[Re: AHK: StringSplit и 4-е подряд пробела.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72107#p72107" />
			<content type="html"><![CDATA[<div class="codebox"><pre><code>text =
(
sec&quot;    &quot;mA&quot;    &quot;mV
3,2452587890625    -0,00311479461379349    0,854992806911469
3,29225610351563    -0,00306393066421151    0,884990870952606
)

s := RegExSplit(text, &quot; {4}|\R&quot;)
loop % s.MaxIndex()
    MsgBox % s[A_Index]

RegExSplit(ByRef string, ByRef pattern, ByRef ommit := &quot;&quot;) {
    startPos := 1, EntryList := []

    while matchPos := RegExMatch(string, pattern, match, startPos)
        EntryList.Insert(Trim(SubStr(string, startPos, matchPos - startPos), ommit))
        , startPos := matchPos + (IsObject(match)? match.len : StrLen(match))

    EntryList.Insert(Trim(SubStr(string, startPos), ommit))
    return EntryList
}</code></pre></div>]]></content>
			<author>
				<name><![CDATA[creature.ws]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=26105</uri>
			</author>
			<updated>2013-05-14T12:02:34Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72107#p72107</id>
		</entry>
		<entry>
			<title type="html"><![CDATA[AHK: StringSplit и 4-е подряд пробела.]]></title>
			<link rel="alternate" href="https://forum.script-coding.com/viewtopic.php?pid=72106#p72106" />
			<content type="html"><![CDATA[<p>Добрый день.<br />Скрипт считывает текстовый файл в переменную, а затем пытается разбить на куски с помощью StringSplit.</p><div class="codebox"><pre><code>Delim=%A_Space%+%A_Space%+%A_Space%+%A_Space%
FileRead, ALL, %SourceFile%
StringSplit, StringArr, ALL , %Delim%</code></pre></div><p> Куски текста (числа), отделены либо 4-мя пробелами либо &quot;концом строки&quot; и &quot;переводом каретки&quot;. Код выше - не работает т.к. пробелы учитывает поштучно, а не 4-е разом. В результате образуется куча пустых переменных.</p><p>Пример считываемого файла:</p><div class="codebox"><pre><code>sec&quot;    &quot;mA&quot;    &quot;mV
3,2452587890625    -0,00311479461379349    0,854992806911469
3,29225610351563    -0,00306393066421151    0,884990870952606
</code></pre></div><p>Спасибо.</p>]]></content>
			<author>
				<name><![CDATA[Mikki]]></name>
				<uri>https://forum.script-coding.com/profile.php?id=5905</uri>
			</author>
			<updated>2013-05-14T11:55:15Z</updated>
			<id>https://forum.script-coding.com/viewtopic.php?pid=72106#p72106</id>
		</entry>
</feed>
