Skip to content
Permalink
Browse files

Add not-equal to text compare block

  • Loading branch information...
bartmathijssen authored and ewpatton committed Aug 28, 2019
1 parent aeaaea2 commit 7452a36fd0497a617b9b183d6dcac6b6ff322fc2
@@ -159,6 +159,12 @@ Blockly.Blocks['text_compare'] = {
titleName: 'OP',
value: 'EQUAL'
}
}, {
translatedName: Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE + Blockly.Msg.LANG_TEXT_COMPARE_NEQ,
dropDown: {
titleName: 'OP',
value: 'NEQ'
}
}, {
translatedName: Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE + Blockly.Msg.LANG_TEXT_COMPARE_GT,
dropDown: {
@@ -170,14 +176,15 @@ Blockly.Blocks['text_compare'] = {

Blockly.Blocks.text_compare.OPERATORS = function () {
return [
[Blockly.Msg.LANG_TEXT_COMPARE_LT, 'LT'], [Blockly.Msg.LANG_TEXT_COMPARE_EQUAL, 'EQUAL'], [Blockly.Msg.LANG_TEXT_COMPARE_GT, 'GT']
[Blockly.Msg.LANG_TEXT_COMPARE_LT, 'LT'], [Blockly.Msg.LANG_TEXT_COMPARE_EQUAL, 'EQUAL'], [Blockly.Msg.LANG_TEXT_COMPARE_NEQ, 'NEQ'], [Blockly.Msg.LANG_TEXT_COMPARE_GT, 'GT']
]
};

Blockly.Blocks.text_compare.TOOLTIPS = function () {
return {
LT: Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_LT,
EQUAL: Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_EQUAL,
NEQ: Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_NEQ,
GT: Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_GT
}
};
@@ -98,7 +98,8 @@ Blockly.Yail['text_compare'] = function() {
Blockly.Yail['text_compare'].OPERATORS = {
LT: ['string<?', 'text<', Blockly.Yail.ORDER_NONE],
GT: ['string>?', 'text>', Blockly.Yail.ORDER_NONE],
EQUAL: ['string=?', 'text=', Blockly.Yail.ORDER_NONE]
EQUAL: ['string=?', 'text=', Blockly.Yail.ORDER_NONE],
NEQ: ['yail-not-equal?', 'not =', Blockly.Yail.ORDER_NONE]
};

Blockly.Yail['text_trim'] = function() {
@@ -583,6 +583,7 @@ Blockly.Msg.de.switch_language_to_german = {

Blockly.Msg.LANG_TEXT_COMPARE_LT = ' <';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = ' =';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_TEXT_COMPARE_GT = ' >';
Blockly.Msg.LANG_TEXT_COMPARE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#compare';
Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE = 'Texte vergleichen';
@@ -600,6 +600,7 @@ Blockly.Msg.en.switch_language_to_english = {

Blockly.Msg.LANG_TEXT_COMPARE_LT = ' <';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = ' =';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_TEXT_COMPARE_GT = ' >';
Blockly.Msg.LANG_TEXT_COMPARE_HELPURL = '/reference/blocks/text.html#compare';
Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE = 'compare texts';
@@ -610,6 +611,10 @@ Blockly.Msg.en.switch_language_to_english = {
+ 'characters in the same order. This is different from ordinary =\n'
+ 'in the case where the text strings are numbers: 123 and 0123 are =\n'
+ 'but not text =.';
Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_NEQ = 'Tests whether text strings are different, ie., don\'t have the same\n'
+ 'characters in the same order. This is different from ordinary ≠\n'
+ 'in the case where the text strings are numbers: 123 and 0123 are text ≠\n'
+ 'but are mathematically =.';
Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_GT = 'Reports whether text1 is lexicographically greater than text2.\n'
+ 'if one text is the prefix of the other, the shorter text is considered smaller.\n'
+ 'Uppercase characters precede lowercase characters.';
@@ -444,6 +444,7 @@ Blockly.Msg.es.switch_language_to_spanish_es = {

Blockly.Msg.LANG_TEXT_COMPARE_LT = ' <';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = ' =';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_TEXT_COMPARE_GT = ' >';
Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE = 'comparar textos';
Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_LT = 'Compara si texto1 es lexicográficamente menor que texto2.\n'
@@ -419,6 +419,7 @@ Blockly.Msg.fr.switch_language_to_french = {
Blockly.Msg.LANG_TEXT_CHANGECASE_TOOLTIP_DOWNCASE = 'Retourne une copie de sa chaine de caractère en argument convertie en minuscule.';
Blockly.Msg.LANG_TEXT_CHANGECASE_TOOLTIP_UPPERCASE = 'Retourne une copie de sa chaine de caractère en argument convertie en majuscule.';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = ' =';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_TEXT_COMPARE_GT = ' >';
Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE = 'comparer textes';
Blockly.Msg.LANG_TEXT_COMPARE_LT = ' <';
@@ -461,6 +461,7 @@ Blockly.Msg.hu.switch_language_to_hungarian = {
Blockly.Msg.LANG_TEXT_ISEMPTY_TOOLTIP = 'Igazzal tér vissza, ha a szöveg\nhossza 0, egyébként hamissal.';
Blockly.Msg.LANG_TEXT_COMPARE_LT = '<';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = '=';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_TEXT_COMPARE_GT = '>';
Blockly.Msg.LANG_TEXT_COMPARE_HELPURL = 'http://appinventor.mit.edu/explore/ai2/support/blocks/text#compare';
Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE = 'szövegek összehasonlítása';
@@ -298,6 +298,7 @@ Blockly.Msg.it.switch_language_to_italian = {
Blockly.Msg.LANG_TEXT_ISEMPTY_INPUT_ISEMPTY = 'è vuoto';
Blockly.Msg.LANG_TEXT_COMPARE_LT = ' <';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = ' =';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_TEXT_COMPARE_GT = ' >';
Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE = 'confronta testi';
Blockly.Msg.LANG_TEXT_TEXT_OBFUSCATE_TOOLTIP = "Restituisce un testo che non può essere facilmente individuato \n"
@@ -335,6 +335,7 @@ Blockly.Msg.ko.switch_language_to_korean = {
Blockly.Msg.LANG_TEXT_ISEMPTY_TOOLTIP = '텍스트 길이가 0이면 참을, 그렇지 않으면 거짓을 반환합니다.';
Blockly.Msg.LANG_TEXT_COMPARE_LT = ' <';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = ' =';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_TEXT_COMPARE_GT = ' >';
Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE = '텍스트 비교하기';
Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_LT = '텍스트1이 텍스트2보다 사전 순서 상 작은지 검사합니다.\n 만약 한 텍스트가 다른 텍스트의 접두사이면, 더 짧은 텍스트가 작은 것으로 간주됩니다. 대문자는 소문자보다 큽니다.';
@@ -51,6 +51,7 @@ Blockly.Msg.nl.switch_language_to_dutch = {
Blockly.Msg.LANG_MATH_CONVERT_ANGLES_TITLE_CONVERT = 'zet om';
Blockly.Msg.LANG_MATH_SINGLE_OP_EXP = 'e^';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = ' =';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_MATH_SINGLE_TOOLTIP_ROOT = 'Geeft de vierkantswortel van een getal.';
Blockly.Msg.LANG_TEXT_REPLACE_ALL_INPUT_TEXT = 'tekst';
Blockly.Msg.LANG_LISTS_ADD_ITEMS_TOOLTIP = 'Voeg items toe aan het einde van een lijst.';
@@ -115,6 +116,7 @@ Blockly.Msg.nl.switch_language_to_dutch = {
Blockly.Msg.LANG_LISTS_INSERT_INPUT_ITEM = 'item';
Blockly.Msg.LANG_CONTROLS_CLOSE_SCREEN_TITLE = 'sluit scherm';
Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_EQUAL = 'Test of stukken tekst identiek zijn, of ze dezelfde karakters hebben\n in dezelfde volgorde. Dit verschilt van de normale=\nin het geval waarin de stukken tekst getallen zijn: 123 en 0123 zijn=\nmaar niet tekst =.';
Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_NEQ = 'Test of stukken tekst verschillend zijn, of ze niet dezelfde karakters hebben\n in dezelfde volgorde. Dit verschilt van de normale≠\nin het geval waarin de stukken tekst getallen zijn: 123 en 0123 zijn tekst ≠\nmaar wiskundig =.';
Blockly.Msg.LANG_MATH_ROUND_TOOLTIP_ROUND = 'Rond een nummer af naar boven of beneden.';
Blockly.Msg.LANG_CONTROLS_FORRANGE_INPUT_END = 'tot';
Blockly.Msg.LANG_COLOUR_ORANGE = 'oranje';
@@ -347,6 +347,7 @@ Blockly.Msg.pl.switch_language_to_polish = {
Blockly.Msg.LANG_TEXT_ISEMPTY_TOOLTIP = 'Zwraca prawdę jeśli długość tekstu\nwynosi 0, fałsz w innym przypadku.';
Blockly.Msg.LANG_TEXT_COMPARE_LT = '<';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = '=';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_TEXT_COMPARE_GT = '>';
Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE = 'porównaj tekst';
Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_LT = 'Sprawdza czy tekst1 jest leksykograficznie mniejszy niż tekst2.\nJeśli jeden tekst jest prefiksem innego, krótszy tekst jest\nuważany za mniejszy. Wielnie znaki poprzedzają małe znaki.';
@@ -53,6 +53,7 @@ Blockly.Msg.pt.switch_language_to_portuguese = {
Blockly.Msg.LANG_MATH_CONVERT_ANGLES_TITLE_CONVERT = 'converter';
Blockly.Msg.LANG_MATH_SINGLE_OP_EXP = 'e^';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = ' =';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_MATH_SINGLE_TOOLTIP_ROOT = 'Retornar a raiz quadrada do número.';
Blockly.Msg.LANG_TEXT_REPLACE_ALL_INPUT_TEXT = 'texto';
Blockly.Msg.LANG_LISTS_ADD_ITEMS_TOOLTIP = 'Adicionar elementos ao final de uma lista.';
@@ -52,6 +52,7 @@ Blockly.Msg.pt.br.switch_language_to_portuguese_br = {
Blockly.Msg.LANG_MATH_CONVERT_ANGLES_TITLE_CONVERT = 'converter';
Blockly.Msg.LANG_MATH_SINGLE_OP_EXP = 'e^';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = ' =';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_MATH_SINGLE_TOOLTIP_ROOT = 'Retornar a raiz quadrada do número.';
Blockly.Msg.LANG_TEXT_REPLACE_ALL_INPUT_TEXT = 'texto';
Blockly.Msg.LANG_LISTS_ADD_ITEMS_TOOLTIP = 'Adicionar itens ao final de uma lista.';
@@ -436,6 +436,7 @@ Blockly.Msg.ru.switch_language_to_russian = {
Blockly.Msg.LANG_TEXT_CHANGECASE_TOOLTIP_DOWNCASE = 'Возвращает копию текста со строчными буквами.';
Blockly.Msg.LANG_TEXT_CHANGECASE_TOOLTIP_UPPERCASE = 'Возвращает копию текста с заглавными буквами. ';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = '=';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_TEXT_COMPARE_GT = ' >';
Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE = 'сравнить тексты';
Blockly.Msg.LANG_TEXT_COMPARE_LT = ' <';
@@ -52,6 +52,7 @@ Blockly.Msg.sv.switch_language_to_swedish = {
Blockly.Msg.LANG_MATH_CONVERT_ANGLES_TITLE_CONVERT = "omvandla"
Blockly.Msg.LANG_MATH_SINGLE_OP_EXP = "e^"
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = " ="
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_MATH_SINGLE_TOOLTIP_ROOT = "Ger kvadratroten ur ett tal."
Blockly.Msg.LANG_TEXT_REPLACE_ALL_INPUT_TEXT = "text"
Blockly.Msg.LANG_LISTS_ADD_ITEMS_TOOLTIP = "Lägger till element i slutet av en lista."
@@ -478,6 +478,7 @@ Blockly.Msg.zh.switch_language_to_chinese_cn = {

Blockly.Msg.LANG_TEXT_COMPARE_LT = ' <';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = ' =';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_TEXT_COMPARE_GT = ' >';
Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE = '字符串比较';
Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_LT = '按字典顺序比较text1是否小于text2,\n'
@@ -481,6 +481,7 @@ Blockly.Msg.zh.switch_language_to_chinese_tw = {

Blockly.Msg.LANG_TEXT_COMPARE_LT = ' <';
Blockly.Msg.LANG_TEXT_COMPARE_EQUAL = ' =';
Blockly.Msg.LANG_TEXT_COMPARE_NEQ = '';
Blockly.Msg.LANG_TEXT_COMPARE_GT = ' >';
Blockly.Msg.LANG_TEXT_COMPARE_INPUT_COMPARE = '文字比較';
Blockly.Msg.LANG_TEXT_COMPARE_TOOLTIP_LT = '判斷左邊文字的首字母順序是否低於右邊文字,\n'
@@ -1787,7 +1787,10 @@ Blockly.Versioning.AllUpgradeMaps =
25: "noUpgrade",

// AI2: In BLOCKS_LANGUAGE_VERSION 26, Added generic event handlers
26: "noUpgrade"
26: "noUpgrade",

// AI2: In BLOCKS_LANGUAGE_VERSION 27, Added not-equal to text compare block
27: "noUpgrade"

}, // End Language upgraders

@@ -458,8 +458,10 @@ private YaVersion() {
// - Added Switch
// For YOUNG_ANDROiD_VERSION 185:
// - SPEECHRECOGNIZER_COMPONENT_VERSION was incremented to 2
// For YOUNG_ANDROID_VERSION 186:
// - BLOCKS_LANGUAGE_VERSION was incremented to 27

public static final int YOUNG_ANDROID_VERSION = 185;
public static final int YOUNG_ANDROID_VERSION = 186;

// ............................... Blocks Language Version Number ...............................

@@ -531,8 +533,10 @@ private YaVersion() {
// - List join with separator block was added.
// For BLOCKS_LANGUAGE_VERSION 26:
// - Generic event handlers were added.
// For BLOCKS_LANGUAGE_VERSION 27:
// - The text compare block was modified to include the not-equal operator

public static final int BLOCKS_LANGUAGE_VERSION = 26;
public static final int BLOCKS_LANGUAGE_VERSION = 27;

// ................................. Component Version Numbers ..................................

@@ -170,7 +170,7 @@ <h3 id="isempty">is empty</h3>
<p>Returns whether or not the string contains any characters (including spaces). When the string length is 0, returns true otherwise it returns false.</p>
<h3 id="compare">compare texts &lt; &gt; =</h3>
<p><img src="images/text/compare.gif" /></p>
<p>Returns whether or not the first string is lexicographically &lt;, &gt;, or = the second string depending on which dropdown is selected.</p>
<p>Returns whether or not the first string is lexicographically &lt;, &gt;, ≠, or = the second string depending on which dropdown is selected.</p>
<p>A string a considered lexicographically greater than another if it is alphabetically greater than the other string. Essentially, it would come after it in the dictionary. All uppercase letters are considered smaller or to occur before lowercase letters. <em>cat</em> would be &gt; <em>Cat</em>.</p>
<h3 id="trim">trim</h3>
<p><img src="images/text/trim.png" /></p>

0 comments on commit 7452a36

Please sign in to comment.
You can’t perform that action at this time.