IecString is an Automation Studio library of string functions.
The functions enhance string manipulation, protect memory, and support ANSI C/C++ and IEC 61131-3.
NOTE: This is not an official library and is supported through the community. IecString is provided as-is under the MIT License agreement. Source code, documentation, and issues are managed through GitHub.
- 🔒 Protect against
- buffer overflow
- overlapping strings
- accessing null pointers
- 🚀 Lightweight performance
- 🚫 Input strings are immutable
- ✅ Compatible with ANSI C/C++ and IEC 61131-3
- 💡 Inspiration from C standard library, Python string methods, JavaScript string methods
Function | Read | Write | Description |
---|---|---|---|
IecStringCopy | 🔍 | 📝 | Copy source to destination up to size of destination or source length |
IecStringConcat | 🔍 | 📝 | Concatenate source to destination up to size of destination or source length |
IecStringCompare | 🔍 | Compare characters of two strings | |
IecStringLength | 🔍 | Determine the length of a string | |
IecStringFirst | 🔍 | First occurrence of character in source | |
IecStringLast | 🔍 | Last occurrence of character in source | |
IecStringFind | 🔍 | Find substring in source | |
IecStringFirstIn | 🔍 | First occurrence in source of any character from find | |
IecStringLengthIn | 🔍 | Initial length in source containing only characters from find | |
IecStringStartsWith | 🔍 | Does source start with prefix | |
IecStringEndsWith | 🔍 | Does source end with suffix | |
IecStringReplace | 🔍 | 📝 | Find in source and replace in destination |
IecStringSplit | 🔍 | 📝 | Split source into tokens |
IecStringFormat | 🔍 | 📝 | Format string with runtime data |
IecStringDecimal | 📝 | Convert integer to string as decimal | |
IecStringFloat | 📝 | Convert float to string | |
IecStringDateTime | 🔍 | 📝 | Format date and/or time |
🔍 The functions marked in the read column are reading from memory.
📝 The functions marked in the write column are writing to memory within the size of destination
.
- Download the binaries and extract the archive
- Add to the project as existing library from the toolbox in logical view
- Clone or download source files
- Add to the project as existing library
- Option to add as reference
Alternatively, add as submodule to an existing project repository.
cd <repository>
git submodule add https://github.com/tmatijevich/IecString.git <project>/Logical/Libraries/IecString
Then add to project as existing library.
See the IecStringProject for all function unit tests and hardware performance tests.
Once installed, the help file can be view using the F1
function key.
See the IecStringHelp. This help is included in the binary download of this library.
- Tyler Matijevich (@tmatijevich)