B4R Library AString for B4R : arduino String for B4R

it is a wrapper for wString from Arduino.

with this library, String are managed like in arduino, in memory and without constraint of B4R stack.
=>AString are available and modifiable from all parts of your script, from all sub, and after a callsubplus.

function ".setxxx" are used to store something in a string, ".addxxx" are used to join something at a string and ".getxxx' are used to load a string from B4R

AString are available / modifiable in inline C : it can be used to move String between B4R script and inline C (see example of script)

list of features from String in arduino and available from B4R :
void setStr(B4RString* str);
void setArr(ArrayByte* str);
void setChr(byte c);
void setByte( byte c, uint16_t base);
void setInt(int16_t i, uint16_t base);
void setUInt( uint16_t ui, uint16_t base);
void setLong(uint32_t l, uint16_t base);
void setULong(uint32_t ul, uint16_t base);
void setDouble(float fl, uint16_t decimalPlaces);
bool reserve(uint16_t size);
uint16_t length();
bool isEmpty();
bool addChr(byte str);
bool addStr(B4RString* str);
bool addArr(ArrayByte* str);
bool addByte(byte c, uint16_t base);
bool addInt(int16_t num, uint16_t base);
bool addUInt(uint16_t num, uint16_t base);
bool addLong(int32_t num, uint16_t base);
bool addULong(uint32_t num, uint16_t base);
bool addDouble(float num, uint16_t base);
int16_t compareToStr(B4RString* s);
int16_t compareToArr(ArrayByte* s);
bool equalsStr(B4RString* s);
bool equalsArr(ArrayByte* s);
bool equalsIgnoreCase(B4RString* s);
bool startsWith(B4RString* prefix);
bool startsWith1(B4RString* prefix, uint16_t offset);
bool endsWith(B4RString* suffix);
byte charAt(uint16_t index);
void setCharAt(uint16_t index, byte c);
void getBytes(ArrayByte* buf, uint16_t index);
void toCharArray(ArrayByte* buf, uint16_t index);
int16_t indexOfChr(byte ch);
int16_t indexOfChr1(byte ch, uint16_t fromIndex);
int16_t indexOfStr(B4RString* str);
int16_t indexOfStr1(B4RString* str, uint16_t fromIndex);
int16_t lastIndexOfChr(byte ch);
int16_t lastIndexOfChr1(byte ch, uint16_t fromIndex);
int16_t lastIndexOfStr(B4RString* str);
int16_t lastIndexOfStr1(B4RString* str, uint16_t fromIndex);
B4RString* substring(uint16_t beginIndex);
B4RString* substring1(uint16_t beginIndex, uint16_t endIndex);
void replaceChr(byte find, byte replace);
void replaceStr(B4RString* find, B4RString* replace);
void remove(uint16_t index);
void remove1(uint16_t index, uint16_t count);
void toLowerCase();
void toUpperCase();
void trim();
int32_t toInt();
float toFloat();

new delivery 1.1 after an issue with esp8266. Now tested with esp32 and esp8266
 

Attachments

  • rAString1.1+.zip
    4.7 KB · Views: 11
Last edited:

hatzisn

Expert
Licensed User
Longtime User
Hi, isn't this compatible with ESP8266? I am getting an error. I will send it privately.
Do I need to install a library in Arduino?
 
Last edited:

hatzisn

Expert
Licensed User
Longtime User

Cableguy

Expert
Licensed User
Longtime User
so, with this we can use "callsubplus(sub2call as string,0) and have the sub2call be "variable"? using it to call a different module?
 
Top