BlocklyProp reference for STRINGS operator blocks
Compatible with all Propeller board types (except Scribbler Robot)
Several string operator blocks have older versions that have been depricated, and if your project contains any of these older blocks, they will appear orange in color. While they will still work, it is a good idea to replace those blocks with newer versions and adjust your code accordingly. Most of the depricated blocks were depricated because they treated strings of text as one-referenced entities (One-referencing is where the first character of a string of text would be counted as character number 1. Zero-referencing is where the first character would be counted as character zero). While one-referecing is easier to understand, it wasn't fully compatible with other blocks and code since C is a zero-referenced language. Never versions of those blocks are all zero-referenced.
string variable set size
The string variable set size block is used to increase or decrease the size of the variable that can hold strings of text. By default, string variables are set to hold up to 64 characters. By decreasing the size of your string variables, you can save memory. By increasing the size of your string variables, you can hold longer strings of text.
Use the gear icon to add additional variables to the list, and set the size of each variable accordingly. If you've defined a constant using the constant define block, you can set the size of your variable to that defined constant when you click on the gear icon.
The compare strings block provides a value of 1 if the comparison between two strings is true, and 0 if the comparison is false. The drop-down menu selection determines the type of comparison:
- the same as
- not the same as
- alphabetically before
- alphabetically after
The alphabetical comparisons are only alphabetical if the case matches - a capital “A” sorts differently than a lowercase “a”.
length of string
The length of string block provides the number of characters in the string, or variable containing a string, inserted into the block.
The combine strings block combines the first and second string and stores them in the variable selected in the drop-down menu. The block uses a buffer, so it is safe to use this block to add text to the beginning or end of a string already stored in a variable.
find string location
The find string location block provides the position of a substring within a larger string. The block gives a number value representing where the starting location of the substring is in the larger string. For example, if you use this block to find the substring “World” in the string “Hello World!”, the block would return 7 because “World” starts at the 7th character in the string.
get character at position
The get character at position block provides the ASCII character (a number value between 0 and 255) for the character found in the string specified in the drop-down menu at the position set by the number value block.
set character at position
The set character at position block sets the ASCII character (a number value between 0 and 255) for the character in the string specified in the drop-down menu at the position set by the number value block.
get part of string
The get part of string block stores the part of the string specified by the first drop-down menu from the start and end positions set by the number value blocks and stores it in the variable specified by the second drop-down menu.
The split string block is used to split up a string separated by the defined character. Can be used more than once to extract multiple string parts.
The trim string block removes extra spaces at the beginning and end of a string of text.
The string empty block is used to test if a string is null or empty.
The create string block is used for making a new string from attached values or text.
Use the gear icon to add additional values such as decimal, hexadecimal, or binary integers, ASCII characters, floating point numbers, or strings of text to the string.
The scan string block is used to look for and extract values or characters from a string. Use the gear icon to add types of values to search for and extract from the string such as decimal, hexadecimal, or binary integers, ASCII characters, or floating point numbers.
string to number (Deprecated)
The string to number block converts the inserted string from decimal, hexadecimal, or binary format into an integer number, then stores the number in the chosen item.
This block has been deprecated. Its functionality is now in the scan string block.
number to string (Deprecated)
The number to string block converts the inserted integer value into a string in decimal, hexadecimal, or binary format, and then stores the string in the chosen item.
This block has been deprecated. Its functionality is now in the create string block.