<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Серый форум &mdash; AHK:Замена символов в строке]]></title>
		<link>https://forum.script-coding.com/viewtopic.php?id=8332</link>
		<atom:link href="https://forum.script-coding.com/extern.php?action=feed&amp;tid=8332&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[Недавние сообщения в теме «AHK:Замена символов в строке».]]></description>
		<lastBuildDate>Wed, 15 May 2019 07:34:10 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=134327#p134327</link>
			<description><![CDATA[<p>Касательно причины переносов строк — <a href="http://forum.script-coding.com/viewtopic.php?id=10138">http://forum.script-coding.com/viewtopic.php?id=10138</a>.</p><p>По поводу исправления текста, набранного в неверной раскладке, тут много сочинений и несколько тем на форуме. Как и всякий порядочный форумчанин я пользуюсь собственным велосипедом — <a href="http://forum.script-coding.com/viewtopic.php?pid=113978#p113978">http://forum.script-coding.com/viewtopi … 78#p113978</a>.</p><div class="quotebox"><cite>a154802 пишет:</cite><blockquote><p>строr</p></blockquote></div><p><img src="//forum.script-coding.com/img/smilies/lol.png" width="15" height="15" /></p>]]></description>
			<author><![CDATA[null@example.com (stealzy)]]></author>
			<pubDate>Wed, 15 May 2019 07:34:10 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=134327#p134327</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=134324#p134324</link>
			<description><![CDATA[<p><strong>a154802</strong>, мне непонятен такой метод, свою проблему (превращение кириллицы в текст, который можно передать в url) я решал вот так:<br /></p><div class="codebox"><pre><code>translit(repstr)
{
	StringReplace, repstr, repstr, а , [[a]] , All
	StringReplace, repstr, repstr, б , [[b]] , All
	StringReplace, repstr, repstr, в , [[v]] , All
	StringReplace, repstr, repstr, г , [[g]] , All
	StringReplace, repstr, repstr, д , [[d]] , All
	StringReplace, repstr, repstr, е , [[e]] , All
	StringReplace, repstr, repstr, ё , [[yo]] , All
	StringReplace, repstr, repstr, ж , [[zh]] , All
	StringReplace, repstr, repstr, з , [[z]] , All
	StringReplace, repstr, repstr, и , [[i]] , All
	StringReplace, repstr, repstr, й , [[j]] , All
	StringReplace, repstr, repstr, к , [[k]] , All
	StringReplace, repstr, repstr, л , [[l]] , All
	StringReplace, repstr, repstr, м , [[m]] , All
	StringReplace, repstr, repstr, н , [[n]] , All
	StringReplace, repstr, repstr, о , [[o]] , All
	StringReplace, repstr, repstr, п , [[p]] , All
	StringReplace, repstr, repstr, р , [[r]] , All
	StringReplace, repstr, repstr, с , [[s]] , All
	StringReplace, repstr, repstr, т , [[t]] , All
	StringReplace, repstr, repstr, у , [[u]] , All
	StringReplace, repstr, repstr, ф , [[f]] , All
	StringReplace, repstr, repstr, х , [[x]] , All
	StringReplace, repstr, repstr, ц , [[cz]] , All
	StringReplace, repstr, repstr, ч , [[ch]] , All
	StringReplace, repstr, repstr, ш , [[sh]] , All
	StringReplace, repstr, repstr, щ , [[shh]] , All
	StringReplace, repstr, repstr, ъ , [[````]] , All
	StringReplace, repstr, repstr, ы , [[y&#039;]] , All
	StringReplace, repstr, repstr, ь , [[``]] , All
	StringReplace, repstr, repstr, э , [[e``]] , All
	StringReplace, repstr, repstr, ю , [[yu]] , All
	StringReplace, repstr, repstr, я , [[ya]] , All

	StringReplace, repstr, repstr, А , [[A]] , All
	StringReplace, repstr, repstr, Б , [[b]] , All
	StringReplace, repstr, repstr, В , [[V]] , All
	StringReplace, repstr, repstr, Г , [[G]] , All
	StringReplace, repstr, repstr, Д , [[D]] , All
	StringReplace, repstr, repstr, Е , [[E]] , All
	StringReplace, repstr, repstr, Ё , [[YO]] , All
	StringReplace, repstr, repstr, Ж , [[ZH]] , All
	StringReplace, repstr, repstr, З , [[Z]] , All
	StringReplace, repstr, repstr, И , [[i]] , All
	StringReplace, repstr, repstr, Й , [[J]] , All
	StringReplace, repstr, repstr, К , [[K]] , All
	StringReplace, repstr, repstr, Л , [[L]] , All
	StringReplace, repstr, repstr, М , [[M]] , All
	StringReplace, repstr, repstr, Н , [[N]] , All
	StringReplace, repstr, repstr, О , [[O]] , All
	StringReplace, repstr, repstr, П , [[P]] , All
	StringReplace, repstr, repstr, Р , [[R]] , All
	StringReplace, repstr, repstr, С , [[S]] , All
	StringReplace, repstr, repstr, Т , [[T]] , All
	StringReplace, repstr, repstr, У , [[u]] , All
	StringReplace, repstr, repstr, Ф , [[F]] , All
	StringReplace, repstr, repstr, Х , [[X]] , All
	StringReplace, repstr, repstr, Ц , [[CZ]] , All
	StringReplace, repstr, repstr, Ч , [[CH]] , All
	StringReplace, repstr, repstr, Ш , [[SH]] , All
	StringReplace, repstr, repstr, Щ , [[SHH]] , All
	StringReplace, repstr, repstr, Ъ , [[````]] , All
	StringReplace, repstr, repstr, Ы , [[Y&#039;]] , All
	StringReplace, repstr, repstr, Ь , [[``]] , All
	StringReplace, repstr, repstr, Э , [[E``]] , All
	StringReplace, repstr, repstr, Ю , [[YU]] , All
	StringReplace, repstr, repstr, Я , [[YA]] , All
	
	return repstr
}</code></pre></div><p>Работает шикарно.</p>]]></description>
			<author><![CDATA[null@example.com (belyankin12)]]></author>
			<pubDate>Wed, 15 May 2019 06:06:27 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=134324#p134324</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=134323#p134323</link>
			<description><![CDATA[<p>Добрый день, начинаю осваивать программмирование в AHK, по этому еще не могу разобраться в некоторый тонкостях. <br />Использовал этот пример как наиболее понятный для замены текста набраного в другой раскладке,</p><div class="codebox"><pre><code>
	string1 := &quot;qwertyuiop[]asdfghjkl;&#039;zxcvbnm,./&quot;
	string2 := &quot;йцукенгшщзхъфывапролджэячсмитьбю.&quot;

	If Clip1 contains q,w,e,r,t,y,u,i,o,p,a,s,d,f,g,h,j,k,l,z,x,c,v,b,n,m
		{
		;MsgBox, The string was found.
		TrayTip, CapsLockV5, В русский, 1, 16
		loop Parse, string1
		StringReplace Clip1, Clip1, % A_LoopField, % SubStr(string2, A_Index, 1), All		
		}
	Else
		{
		;MsgBox, The string was not found.
		TrayTip, CapsLockV5, В английский, 1, 16
		loop Parse, string2
		StringReplace Clip1, Clip1, % A_LoopField, % SubStr(string1, A_Index, 1), All			
		}
Send %Clip1%
</code></pre></div><p>модифицировал пример под свои нужды, пока сделал автоматическое определение раскладки и перевода, в последующем думаю все таки остановлюсь на принудительном выборе. <br />Обнаружил у этого примера одну особенность/баг/фичу, если менять раскладку у примера с разрывом строк и переводом каретки, то вставляется 2 перевода строк и каретки.<br />Думал проблема в отсутствии указателя разделения строr в функции &quot;loop Parse, string1&quot;, использовал &quot;loop Parse, string1, `r, `n&quot;, проблема осталась. Попробовал удалить 2ные разделители принудительно &quot;StringReplace, Clip1, Clip1, `r`n`r`n, `r`n, All&quot;, не помогло.<br />Как запустить дебаггер не знаю(( по этому не могу понять откуда такой эффект.</p>]]></description>
			<author><![CDATA[null@example.com (a154802)]]></author>
			<pubDate>Wed, 15 May 2019 05:37:20 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=134323#p134323</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=72458#p72458</link>
			<description><![CDATA[<div class="quotebox"><cite>creature.ws пишет:</cite><blockquote><p>В альфа версии autohotkey 2 отсутствие : уже считается ошибкой.</p></blockquote></div><p>Усё ясно. Спасибо за разъяснения.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 26 May 2013 14:46:38 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=72458#p72458</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=72457#p72457</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Я и не хотел использовать тернарный оператор</p></blockquote></div><p>Но вы же его используете, вдобавок не указав третий операнд.<br /></p><div class="codebox"><pre><code>Так и вопрос, почему это ошибка?</code></pre></div><p>Потому, что нет оператора <strong>?</strong>, есть оператор <strong>? :</strong><br />В альфа версии autohotkey 2 отсутствие <strong>:</strong> <em>уже</em> считается ошибкой.</p>]]></description>
			<author><![CDATA[null@example.com (creature.ws)]]></author>
			<pubDate>Sun, 26 May 2013 14:42:35 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=72457#p72457</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=72456#p72456</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>предполагаю, что предпосылка к этому — желание сократить код, написать его в одну строку</p></blockquote></div><p>Нет. Я же ответил:</p><div class="quotebox"><blockquote><p>Я и не хотел использовать тернарный оператор во избежании вызова лишней операции присваивания переменной.</p></blockquote></div><div class="quotebox"><blockquote><p>предложил краткий вариант записи с эквивалентной функциональностью, но не содержащий ошибок.</p></blockquote></div><p>Так и вопрос, почему это ошибка? Где упоминание про &quot;&amp;&amp;&quot;? Если использовать тернарное выражение, то в нём условие можно не заключать в скобки. Без &quot;или&quot;, условие в скобках обязательно. И дело в том что это я выявил случайно. То есть я в справке не видел примера записи что &quot;если&quot; это, тогда &quot;то&quot; - в одно строку.<br />Потому не пойму где указано что правильно по другому. Но и не нашёл где пишется так, как я пишу <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /><br />Или вы имеете в виду что это баг, который могут поправить, и код станет не рабочим? (вопрос риторический)</p><p>Вообщем суть я уловил. Так писать неправильно.</p><p>ТС. Поправьте код на:<br /></p><div class="codebox"><pre><code>loop Parse, text 
    res .= (p := InStr(string1, A_LoopField, 1)) ?  SubStr(string2, p, 1) : &quot;&quot;
MsgBox  % res</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 26 May 2013 14:36:59 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=72456#p72456</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=72455#p72455</link>
			<description><![CDATA[<p>Кажется, этот диалог никогда не закончится.<br /></p><div class="quotebox"><blockquote><p>Наверное вы имели ввиду:</p></blockquote></div><p>Да какая разница.<br /></p><div class="quotebox"><blockquote><p>Можно пруфлинк на рекомндуемое использование &quot;&amp;&amp;&quot;</p></blockquote></div><p>В коде сообщения #16 вы зачем-то использовали <br /></p><div class="codebox"><pre><code>(p := InStr(string1, A_LoopField, 1)) ? res .= SubStr(string2, p, 1)</code></pre></div><p>предполагая, что предпосылка к этому — желание сократить код, написать его в одну строку, помимо уточнения сути тернарного оператора, в сообщении #18 предложил краткий вариант записи с эквивалентной функциональностью, но не содержащий ошибок.<br /> <br /> <br />В справке вы можете найти статью if (expression), если слова без пруфлинка мало значат — используйте «официальную» конструкцию<br /></p><div class="codebox"><pre><code>if (p := InStr(string1, A_LoopField, 1))
    res .= SubStr(string2, p, 1)</code></pre></div><p>или приведите пруфлинк, по которому рекомендуется использование<br /></p><div class="codebox"><pre><code>(p := InStr(string1, A_LoopField, 1)) ? res .= SubStr(string2, p, 1)</code></pre></div>]]></description>
			<author><![CDATA[null@example.com (creature.ws)]]></author>
			<pubDate>Sun, 26 May 2013 14:16:02 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=72455#p72455</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=72453#p72453</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>допускается конструкция (сondition)? ifBranch без : elseBranch</p></blockquote></div><p>Наверное вы имели ввиду: </p><div class="codebox"><pre><code>(if exp) ? then exp : else exp</code></pre></div><br /><br /><div class="codebox"><pre><code>(if exp) ? then exp</code></pre></div><p>Можно пруфлинк на рекомендуемое использование &quot;&amp;&amp;&quot; в данном случае? Я что-то в справке не найду.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 26 May 2013 14:02:00 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=72453#p72453</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=72451#p72451</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>В чём большой смысл замены</p></blockquote></div><p>Смысле не в замене ? на &amp;&amp;, а в правильном использовании тернарного оператора. То, что в версии 1.1 допускается конструкция <em>(сondition)? ifBranch</em> без <em>: elseBranch</em> — стандартная для Autohotkey синтаксическая поблажка.</p>]]></description>
			<author><![CDATA[null@example.com (creature.ws)]]></author>
			<pubDate>Sun, 26 May 2013 07:02:51 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=72451#p72451</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=72448#p72448</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>Тернарный оператор подразумевает наличие трёх логических фрагментов.</p></blockquote></div><p>Не понимаю я вашей принципиальности по этому вопросу. В чём большой смысл замены &quot;?&quot; на &quot;&amp;&amp;&quot;. Я и не хотел использовать тернарный оператор во избежании вызова лишней операции присваивания переменной. Пусть будет:<br /></p><div class="codebox"><pre><code>     (p := InStr(string1, A_LoopField, 1))  Тогда такой  res .= SubStr(string2, p, 1) </code></pre></div><p>Что это меняет?</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sun, 26 May 2013 03:11:39 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=72448#p72448</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=72439#p72439</link>
			<description><![CDATA[<div class="codebox"><pre><code>(p := InStr(string1, A_LoopField, 1)) ? res .= SubStr(string2, p, 1)</code></pre></div><p>Тернарный оператор подразумевает наличие трёх логических фрагментов.<br />Уместно его применять если присутствует «или»<br /></p><div class="codebox"><pre><code>res .= (p := InStr(string1, A_LoopField, 1)) ?  SubStr(string2, p, 1) : &quot;другая строка&quot;</code></pre></div><p>Однострочный аналог <em>if (condition) action</em> это <em>(condition) and action</em></p>]]></description>
			<author><![CDATA[null@example.com (creature.ws)]]></author>
			<pubDate>Sat, 25 May 2013 19:23:25 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=72439#p72439</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=72433#p72433</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>serzh82saratov, Заменить ничего неизменив?</p></blockquote></div><p>Иначе переменная была пуста, без пробела. Спасибо за код</p>]]></description>
			<author><![CDATA[null@example.com (avens)]]></author>
			<pubDate>Sat, 25 May 2013 17:35:47 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=72433#p72433</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=72431#p72431</link>
			<description><![CDATA[<div class="quotebox"><blockquote><p>пришлось заменить</p></blockquote></div><p>Заменить ничего неизменив?</p><p>А если так:<br /></p><div class="codebox"><pre><code>
text := &quot;aC &amp;&quot;
string1 := &quot;aBC- &amp;&quot;
string2 := &quot;12 567&quot;

loop Parse, text 
    (p := InStr(string1, A_LoopField, 1)) ? res .= SubStr(string2, p, 1)
MsgBox  % res
</code></pre></div><div class="quotebox"><blockquote><p>но все равно 1667, видно что то у меня, буду разбираться.</p></blockquote></div><p>Тот код так и должен работать, там должно быть &quot;1667&quot;.</p>]]></description>
			<author><![CDATA[null@example.com (serzh82saratov)]]></author>
			<pubDate>Sat, 25 May 2013 17:15:13 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=72431#p72431</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=72430#p72430</link>
			<description><![CDATA[<p>Не надо конделябры <img src="//forum.script-coding.com/img/smilies/smile.png" width="15" height="15" /></p><p>Я просто еще в своем скрипте думал что пробелы будут учитываться, но пришлось заменить:<br /></p><div class="codebox"><pre><code>destChar = %A_LoopField%
dest = %dest%%destChar%

на

destChar:= A_LoopField
dest:= dest destChar</code></pre></div><p>Скачал последнюю версию, но все равно 1667, видно что то у меня, буду разбираться.</p>]]></description>
			<author><![CDATA[null@example.com (avens)]]></author>
			<pubDate>Sat, 25 May 2013 16:55:04 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=72430#p72430</guid>
		</item>
		<item>
			<title><![CDATA[Re: AHK:Замена символов в строке]]></title>
			<link>https://forum.script-coding.com/viewtopic.php?pid=72429#p72429</link>
			<description><![CDATA[<p><a href="http://translate.google.com/#auto/ru/capacity">capacity</a><br />Разве речь может идти о мощности в данном контексте? «Синонимы» в таком случае искать нужно. «Вместимость» подходит лучше всего.</p>]]></description>
			<author><![CDATA[null@example.com (creature.ws)]]></author>
			<pubDate>Sat, 25 May 2013 16:36:57 +0000</pubDate>
			<guid>https://forum.script-coding.com/viewtopic.php?pid=72429#p72429</guid>
		</item>
	</channel>
</rss>
