-
Notifications
You must be signed in to change notification settings - Fork 15
Text Functions
Utility functions for amibroker that work on text data. These functions are available in text-util.afl. To use these functions, add following line at the top of your afl:
#include <text-util.afl>AmiBroker substring function. Returns a string that is a substring of the text. Implementation of Java substring function in AmiBroker. For more details see javadoc.
result = strSubstring("smiles", 1, 5);
// result will be "mile"| Parameter | Type | Description |
|---|---|---|
| text | string | the text to operate on |
| beginIndex | integer | the beginning index (inclusive), index of first character is zero |
| endIndex | integer | the ending index (exclusive) |
Amibroker function that returns first N characters of a string.
result = strFirstN("abcdef", 2);
// result will be "ab"| Parameter | Type | Description |
|---|---|---|
| text | string | the text to operate on |
| n | integer | number of characters |
Amibroker function that returns last N characters of a string.
result = strLastN("BANKNIFTY2010932400PE", 2);
// result will be "PE"| Parameter | Type | Description |
|---|---|---|
| text | string | the text to operate on |
| n | integer | number of characters |
Amibroker function to find whether two strings are equal (case-sensitive).
result = strEquals("Apple", "Orange");
// result will be false or zero
result = strEquals("Apple", "Apple");
// result will be true or one| Parameter | Type | Description |
|---|---|---|
| a | string | the first string to compare |
| b | string | the first string to compare |
Amibroker function to find whether two strings are equal (case-insensitive).
result = strEqualsIgnoreCase("Apple", "Orange");
// result will be false or zero
result = strEqualsIgnoreCase("APPLE", "apple");
// result will be true or one| Parameter | Type | Description |
|---|---|---|
| a | string | the first string to compare |
| b | string | the first string to compare |
Amibroker function to find whether a string starts with specified prefix.
result = strStartsWith("Apple", "Ora");
// result will be false or zero
result = strStartsWith("Apple", "App");
// result will be true or one| Parameter | Type | Description |
|---|---|---|
| text | string | the string to check |
| prefix | string | the prefix |
Amibroker function to find whether a string ends with specified suffix.
result = strEndsWith("Apple", "ilk");
// result will be false or zero
result = strEndsWith("Apple", "ple");
// result will be true or one| Parameter | Type | Description |
|---|---|---|
| text | string | the string to check |
| suffix | string | the suffix |